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-08 13:03:40
阅读次数:
106
Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
Credits:
Special thanks to @ts for adding this problem and creating all...
分类:
编程语言 时间:
2015-01-07 23:42:23
阅读次数:
401
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 numbers such that they add up to the target, whe...
分类:
其他好文 时间:
2015-01-07 23:40:44
阅读次数:
362
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)).
分析
这是一道非常经典的题。这题更通用的形式是,给定两个已经排序...
分类:
其他好文 时间:
2015-01-07 23:39:15
阅读次数:
345
Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi...
分类:
其他好文 时间:
2015-01-07 21:54:23
阅读次数:
141
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 numbers such that they add up to the target, whe...
分类:
其他好文 时间:
2015-01-07 16:50:55
阅读次数:
158
Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.Naive方法:A simple method is...
分类:
其他好文 时间:
2015-01-07 08:11:12
阅读次数:
117
Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ret...
分类:
其他好文 时间:
2015-01-07 00:23:00
阅读次数:
245
Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should ru...
分类:
其他好文 时间:
2015-01-06 17:35:22
阅读次数:
152
题目:
Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
For example,
Given sorted array A = [1,1,1,2,2,3],
Your function should return length = 5, and A is no...
分类:
编程语言 时间:
2015-01-06 15:41:57
阅读次数:
163