03 2019 档案
发表于 2019-03-31 12:15阅读:201评论:0推荐:0
摘要:1029. Binary Prefix Divisible By 5 Given an array A of 0s and 1s, consider N_i: the i-th subarray from A[0] to A[i] interpreted as a binary number (fr
阅读全文 »
发表于 2019-03-30 11:29阅读:163评论:0推荐:0
摘要:Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Example 2: Note: Try to come up as many solutions as you
阅读全文 »
发表于 2019-03-28 19:43阅读:271评论:0推荐:0
摘要:There are N piles of stones arranged in a row. The i-th pile has stones[i] stones. A move consists of merging exactly K consecutive piles into one pil
阅读全文 »
发表于 2019-03-28 17:23阅读:361评论:0推荐:0
摘要:A subarray A[i], A[i+1], ..., A[j] of A is said to be turbulent if and only if: For i <= k < j, A[k] > A[k+1] when k is odd, and A[k] < A[k+1] when k
阅读全文 »
发表于 2019-03-28 17:04阅读:284评论:0推荐:0
摘要:You are given an integer array A. From some starting index, you can make a series of jumps. The (1st, 3rd, 5th, ...) jumps in the series are called od
阅读全文 »
发表于 2019-03-27 22:34阅读:270评论:0推荐:0
摘要:Given a string S, count the number of distinct, non-empty subsequences of S . Since the result may be large, return the answer modulo 10^9 + 7. Exampl
阅读全文 »
发表于 2019-03-27 21:51阅读:339评论:0推荐:0
摘要:A chess knight can move as indicated in the chess diagram below: . This time, we place our chess knight on any numbered key of a phone pad (indicated
阅读全文 »
发表于 2019-03-26 18:27阅读:229评论:0推荐:0
摘要:Given a square array of integers A, we want the minimum sum of a falling path through A. A falling path starts at any element in the first row, and ch
阅读全文 »
发表于 2019-03-26 17:52阅读:228评论:0推荐:0
摘要:Your music player contains N different songs and she wants to listen to L (not necessarily different) songs during your trip. You create a playlist so
阅读全文 »
发表于 2019-03-25 10:21阅读:232评论:0推荐:0
摘要:We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. (Note that '0' is not included.) Now, we write numbers
阅读全文 »
发表于 2019-03-25 09:19阅读:259评论:0推荐:0
摘要:We have an array A of non-negative integers. For every (contiguous) subarray B = [A[i], A[i+1], ..., A[j]] (with i <= j), we take the bitwise OR of al
阅读全文 »
发表于 2019-03-24 16:29阅读:244评论:0推荐:0
摘要:You are given K eggs, and you have access to a building with N floors from 1 to N. Each egg is identical in function, and if an egg breaks, you cannot
阅读全文 »
发表于 2019-03-24 14:40阅读:251评论:0推荐:0
摘要:1020. Partition Array Into Three Parts With Equal Sum Given an array A of integers, return true if and only if we can partition the array into three n
阅读全文 »
发表于 2019-03-23 21:06阅读:461评论:0推荐:0
摘要:一、扩大英语词汇量 名词 形容词(-al) industrial(工业的) 二、夯实语法基础知识 常见的语法现象:如虚拟语气、倒装、主动语态、被动语态、省略句等。 英语中可以充当定语的成分比较复杂, 如名词, 形容词, 形容词性物主代词, 介词短语, 非谓语动词中的分词 (现在分词与过去分词) ,
阅读全文 »
发表于 2019-03-23 16:17阅读:298评论:0推荐:0
摘要:There are G people in a gang, and a list of various crimes they could commit. The i-th crime generates a profit[i] and requires group[i] gang members
阅读全文 »
发表于 2019-03-23 12:45阅读:258评论:0推荐:0
摘要:A sequence X_1, X_2, ..., X_n is fibonacci-like if: n >= 3 X_i + X_{i+1} = X_{i+2} for all i + 2 <= n Given a strictly increasing array A of positive
阅读全文 »
发表于 2019-03-22 21:37阅读:266评论:0推荐:0
摘要:An undirected, connected graph of N nodes (labeled 0, 1, 2, ..., N-1) is given as graph. graph.length = N, and j != i is in the list graph[i] exactly
阅读全文 »
发表于 2019-03-22 21:04阅读:323评论:0推荐:0
摘要:There are N dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to t
阅读全文 »
发表于 2019-03-21 17:52阅读:279评论:0推荐:0
摘要:We partition a row of numbers A into at most K adjacent (non-empty) groups, then our score is the sum of the average of each group. What is the larges
阅读全文 »
发表于 2019-03-19 21:47阅读:408评论:0推荐:0
摘要:We have two integer sequences A and B of the same non-zero length. We are allowed to swap elements A[i] and B[i]. Note that both elements are in the s
阅读全文 »
发表于 2019-03-19 20:47阅读:303评论:0推荐:0
摘要:We have two types of tiles: a 2x1 domino shape, and an "L" tromino shape. These shapes may be rotated. Given N, how many ways are there to tile a 2 x
阅读全文 »
发表于 2019-03-18 22:26阅读:290评论:0推荐:0
摘要:In a 2D grid from (0, 0) to (N-1, N-1), every cell contains a 1, except those cells in the given list mines which are 0. What is the largest axis-alig
阅读全文 »
发表于 2019-03-17 17:19阅读:238评论:0推荐:0
摘要:1012. Complement of Base 10 Integer Every non-negative integer N has a binary representation. For example, 5 can be represented as "101" in binary, 11
阅读全文 »
发表于 2019-03-15 12:27阅读:327评论:0推荐:0
摘要:On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. Y
阅读全文 »
发表于 2019-03-15 09:44阅读:274评论:0推荐:0
摘要:In a N x N grid representing a field of cherries, each cell is one of three possible integers. 0 means the cell is empty, so you can pass through; 1 m
阅读全文 »
发表于 2019-03-14 22:13阅读:209评论:0推荐:0
摘要:Given an array nums of integers, you can perform operations on the array. In each operation, you pick any nums[i] and delete it to earn nums[i] points
阅读全文 »
发表于 2019-03-14 20:53阅读:234评论:0推荐:0
摘要:Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Example 2: Note: 0 < s1.length, s2.len
阅读全文 »
发表于 2019-03-14 18:46阅读:237评论:0推荐:0
摘要:Given an array of integers nums and a positive integer k, find whether it's possible to divide this array into k non-empty subsets whose sums are all
阅读全文 »
发表于 2019-03-13 18:17阅读:207评论:0推荐:0
摘要:In a given array nums of positive integers, find three non-overlapping subarrays with maximum sum. Each subarray will be of size k, and we want to max
阅读全文 »
发表于 2019-03-13 17:06阅读:270评论:0推荐:0
摘要:Given a string S, find the number of different non-empty palindromic subsequences in S, and return that number modulo 10^9 + 7. A subsequence of a str
阅读全文 »
发表于 2019-03-13 13:25阅读:300评论:0推荐:0
摘要:On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves. The rows and columns are 0 indexed, so the
阅读全文 »
发表于 2019-03-13 12:44阅读:173评论:0推荐:0
摘要:Given an unsorted array of integers, find the number of longest increasing subsequence. Example 1: Example 2: Note: Length of the given array will be
阅读全文 »
发表于 2019-03-12 16:16阅读:238评论:0推荐:0
摘要:There is a strange printer with the following two special requirements: The printer can only print a sequence of the same character each time. At each
阅读全文 »
发表于 2019-03-12 15:30阅读:230评论:0推荐:0
摘要:Initially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step: Given a number n. You have to
阅读全文 »
发表于 2019-03-12 11:37阅读:238评论:0推荐:0
摘要:这是课程里给的代码,自己看着讲义在里面加了些注释。
阅读全文 »
发表于 2019-03-11 16:38阅读:191评论:0推荐:0
摘要:Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are c
阅读全文 »
发表于 2019-03-11 16:02阅读:177评论:0推荐:0
摘要:You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can follow an
阅读全文 »
发表于 2019-03-10 22:27阅读:293评论:0推荐:0
摘要:A message containing letters from A-Z is being encoded to numbers using the following mapping way: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Beyond that, now th
阅读全文 »
发表于 2019-03-10 21:30阅读:250评论:0推荐:0
摘要:In LeetCode Store, there are some kinds of items to sell. Each item has a price. However, there are some special offers, and a special offer consists
阅读全文 »
发表于 2019-03-10 20:30阅读:363评论:0推荐:0
摘要:Given two integers n and k, find how many different arrays consist of numbers from 1 to n such that there are exactly k inverse pairs. We define an in
阅读全文 »
发表于 2019-03-09 22:24阅读:293评论:0推荐:0
摘要:Given a positive integer n, find the number of non-negative integers less than or equal to n, whose binary representations do NOT contain consecutive
阅读全文 »
发表于 2019-03-08 21:51阅读:287评论:0推荐:0
摘要:There is an m by n grid with a ball. Given the start coordinate (i,j) of the ball, you can move the ball to adjacent cell or cross the grid boundary i
阅读全文 »
发表于 2019-03-08 20:51阅读:253评论:0推荐:0
摘要:Given a positive integer n, return the number of all possible attendance records with length n, which will be regarded as rewardable. The answer may b
阅读全文 »
发表于 2019-03-08 12:13阅读:213评论:0推荐:0
摘要:You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : L
阅读全文 »
发表于 2019-03-07 22:08阅读:339评论:0推荐:0
摘要:Given several boxes with different colors represented by different positive numbers. You may experience several rounds to remove boxes until there is
阅读全文 »
发表于 2019-03-07 20:56阅读:216评论:0推荐:0
摘要:Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that
阅读全文 »
发表于 2019-03-07 18:28阅读:205评论:0推荐:0
摘要:You have n super washing machines on a line. Initially, each washing machine has some dresses or is empty. For each move, you could choose any m (1 ≤
阅读全文 »
发表于 2019-03-07 11:56阅读:163评论:0推荐:0
摘要:Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000. Example 1:Input: "bbbab
阅读全文 »
发表于 2019-03-07 11:03阅读:196评论:0推荐:0
摘要:Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and t
阅读全文 »
发表于 2019-03-06 22:32阅读:249评论:0推荐:0
摘要:Consider the string s to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so s will look like this: "...zabcdefghijklmnopqrstuvwxyza
阅读全文 »
发表于 2019-03-06 21:33阅读:273评论:0推荐:0
摘要:In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue. For now, suppose you are a domin
阅读全文 »
发表于 2019-03-06 18:04阅读:215评论:0推荐:0
摘要:完整的类定义: 完整的接口定义: 有三种方法要求固定的声明方式 完整的java源文件
阅读全文 »
发表于 2019-03-06 15:54阅读:278评论:0推荐:0
摘要:用“埃氏筛法”求2~10000以内的素数。2~10000以内的数,先去掉2的倍数,再去掉3的倍数,再去掉4的倍数,……依此类推,最后剩下的就是素数。 Code:
阅读全文 »
发表于 2019-03-05 22:18阅读:320评论:0推荐:0
摘要:Define S = [s,n] as the string S which consists of n connected strings s. For example, ["abc", 3] ="abcabcabc". On the other hand, we define that stri
阅读全文 »
发表于 2019-03-01 22:37阅读:272评论:0推荐:0
摘要:萌萌哒表情符号通常由“手”、“眼”、“口”三个主要部分组成。简单起见,我们假设一个表情符号是按下列格式输出的: 现给出可选用的符号集合,请你按用户的要求输出表情。 输入格式: 输入首先在前三行顺序对应给出手、眼、口的可选符号集。每个符号括在一对方括号 []内。题目保证每个集合都至少有一个符号,并不超
阅读全文 »
发表于 2019-03-01 22:36阅读:357评论:0推荐:0
摘要:批改多选题是比较麻烦的事情,本题就请你写个程序帮助老师批改多选题,并且指出哪道题错的人最多。 输入格式: 输入在第一行给出两个正整数 N(≤ 1000)和 M(≤ 100),分别是学生人数和多选题的个数。随后 M 行,每行顺次给出一道题的满分值(不超过 5 的正整数)、选项个数(不少于 2 且不超过
阅读全文 »