摘要: 书中代码有误。书中为sort(a+1,a+n+1,Cmp)。 阅读全文
posted @ 2019-01-13 22:56 yuxihong 阅读(267) 评论(0) 推荐(0) 编辑
摘要: Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target. 阅读全文
posted @ 2019-01-13 21:18 yuxihong 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays. Example 1: Note: Runtime: 78 ms, faster than 4 阅读全文
posted @ 2019-01-13 20:20 yuxihong 阅读(169) 评论(0) 推荐(0) 编辑
摘要: Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one cha 阅读全文
posted @ 2019-01-13 19:27 yuxihong 阅读(107) 评论(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 阅读全文
posted @ 2019-01-13 17:28 yuxihong 阅读(189) 评论(0) 推荐(0) 编辑
摘要: Starting with a positive integer N, we reorder the digits in any order (including the original order) such that the leading digit is not zero. Return  阅读全文
posted @ 2019-01-13 13:43 yuxihong 阅读(206) 评论(0) 推荐(0) 编辑
摘要: Write an iterator that iterates through a run-length encoded sequence. The iterator is initialized by RLEIterator(int[] A), where A is a run-length en 阅读全文
posted @ 2019-01-13 13:25 yuxihong 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Given an array A of integers, return the number of (contiguous, non-empty) subarrays that have a sum divisible by K. Example 1: Input: A = [4,5,0,-2,- 阅读全文
posted @ 2019-01-13 13:11 yuxihong 阅读(175) 评论(0) 推荐(0) 编辑
摘要: We have a list of points on the plane. Find the K closest points to the origin (0, 0). (Here, the distance between two points on a plane is the Euclid 阅读全文
posted @ 2019-01-13 13:04 yuxihong 阅读(333) 评论(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 阅读全文
posted @ 2019-01-13 12:57 yuxihong 阅读(211) 评论(0) 推荐(0) 编辑
摘要: Write a class StockSpanner which collects daily price quotes for some stock, and returns the span of that stock's price for the current day. The span 阅读全文
posted @ 2019-01-13 10:09 yuxihong 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Given a C++ program, remove comments from it. The program source is an array where source[i] is the i-th line of the source code. This represents the 阅读全文
posted @ 2019-01-13 04:37 yuxihong 阅读(148) 评论(0) 推荐(0) 编辑