Typical solution: convert it to Maximum Array problem.And here is my solution: O(n) by using Greedy strategy on this equation: sum[i..j] = sum[0..j] -...
分类:
其他好文 时间:
2015-09-13 14:33:22
阅读次数:
166
Using XOR on bits.class Solution {public: /* * @param a: The first integer * @param b: The second integer * @return: The sum of a and b...
分类:
其他好文 时间:
2015-09-13 13:17:42
阅读次数:
189
Given an array with positive and negative integers. Re-range it to interleaving with positive and negative integers.ExampleGiven[-1, -2, -3, 4, 5, 6],...
分类:
其他好文 时间:
2015-09-09 11:07:25
阅读次数:
137
Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.ExampleGiven 4 points:(1,2),(3,6),(0,0),(1,3).The max...
分类:
其他好文 时间:
2015-09-08 06:57:23
阅读次数:
171
1. Convert Expression to Reverse Polish Notation http://www.lintcode.com/en/problem/convert-expression-to-polish-notation/ Given an expression string ...
分类:
编程语言 时间:
2015-09-05 22:03:18
阅读次数:
315
Given an array containsNnumbers of 0 ..N, find which number doesn't exist in the array.ExampleGivenN=3and the array[0, 1, 3], return2.ChallengeDo it i...
分类:
其他好文 时间:
2015-09-04 12:35:59
阅读次数:
156
两个字符串是变位词 1 class Solution: 2 """ 3 @param s: The first string 4 @param b: The second string 5 @return true or false 6 """ 7 d...
分类:
其他好文 时间:
2015-09-04 11:08:17
阅读次数:
187
sum[i..j] = sum[0..j] - sum[0..i-1]. We use a hashmap to check a previous matching index with a given number.class Solution {public: vector subarra...
分类:
其他好文 时间:
2015-09-04 07:34:42
阅读次数:
181
Kth Smallest Number in Sorted MatrixFind thekth smallest number in at row and column sorted matrix.Have you met this question in a real interview?YesE...
分类:
其他好文 时间:
2015-09-03 21:33:55
阅读次数:
202
Expression Tree BuildThe structure of Expression Tree is a binary tree to evaluate certain expressions. All leaves of the Expression Tree have an numb...
分类:
其他好文 时间:
2015-09-02 23:11:37
阅读次数:
176