There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
public class Solution {
pu...
分类:
其他好文 时间:
2015-01-04 21:25:03
阅读次数:
150
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
分类:
其他好文 时间:
2015-01-04 15:10:14
阅读次数:
132
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
1
/ 2 5
/ \ 3 4 6
The flattened tree should look like:
1
...
分类:
其他好文 时间:
2015-01-04 12:12:13
阅读次数:
128
QUESTIONGiven an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.FIRST TRYclass Sol...
分类:
其他好文 时间:
2015-01-03 19:49:18
阅读次数:
178
Longest Common SubsequenceGiven two strings, find the longest comment subsequence (LCS).Your code should return the length of LCS.样例For "ABCD" and "ED...
分类:
其他好文 时间:
2015-01-03 15:55:06
阅读次数:
177
Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
解析:
只有2和5相乘才会出现0,其中整十也可以看做是2和5相乘的结果,所以,可以在n之前看看有多少个2以及多少个5就行了,又发现2的数量...
分类:
其他好文 时间:
2015-01-02 22:28:57
阅读次数:
213
Es6 provides "Set", it likes array but the data inside should be unqiue."Set" is a construct function, you should call:var s = new Set();Methods:1.add...
分类:
其他好文 时间:
2015-01-02 06:26:51
阅读次数:
223
note:Description and Usage of Fields in RA_INTERFACE_LINES Table [ID 1195997.1]核心内容: Field Name and DescriptionValidation and DestinationUser should provide data when... and Reference InformationINTER...
分类:
其他好文 时间:
2015-01-01 12:31:52
阅读次数:
1058
As the title described, you should only use two stacks to implement a queue's actions.The queue should support push(element), pop() and top() where po...
分类:
其他好文 时间:
2015-01-01 01:24:17
阅读次数:
202
Given two strings, find the longest comment subsequence (LCS).Your code should return the length of LCS.ExampleFor "ABCD" and "EDCA", the LCS is "A" (...
分类:
其他好文 时间:
2015-01-01 00:12:17
阅读次数:
122