Spiral Matrix IIGiven an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the...
分类:
其他好文 时间:
2015-01-08 21:32:10
阅读次数:
209
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input st...
分类:
其他好文 时间:
2015-01-08 20:17:55
阅读次数:
216
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