Search in Rotated Sorted Array Total Accepted: 50423 Total Submissions: 173779 My Submissions Question Solution
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2...
分类:
其他好文 时间:
2015-04-15 21:27:22
阅读次数:
135
Flatten Binary Tree to Linked List
Given a binary tree, flatten it to a linked list in-place....
分类:
其他好文 时间:
2015-04-07 09:58:30
阅读次数:
135
problem:
Merge k sorted linked lists and return it as one sorted list.
Analyze and describe its complexity.
Tags Divide and Conquer Linked List Heap
合并K个已序单链表
thinking:
(1)题目没有要求不可以新开ListN...
分类:
其他好文 时间:
2015-03-20 16:24:45
阅读次数:
114
Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string.
If the last word does not exist, return 0.
Note: A wor...
分类:
其他好文 时间:
2015-02-12 18:32:44
阅读次数:
173
Spiral MatrixGiven a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following ...
分类:
其他好文 时间:
2015-02-07 17:15:17
阅读次数:
107
【 声明:版权所有,欢迎转载,请勿用于商业用途。 联系信箱:feixiaoxing @163.com】 最近一段时间,发现自己编写代码的能力下降了很多。所以,网上找了一下,看看有没有类似可以提高的项目。偶尔看别人都在leetcode上刷题目,感觉特别有意思,所以拿来练练手。因为leetcode上每个题目有很多测试用例,所以你上传的代码必须要全部通过这些测试用例才行。 不多说,为了不丢...
分类:
其他好文 时间:
2015-02-01 20:30:36
阅读次数:
213
二分法的题,题目一般是在一个有序或者有序打乱的array里找一个target,或者在array里找一个数。这种题型的解题方式可以提炼出来一个套路,如下: int low = 0 ; int high = num.length-1 ; int mid = 0 ; ...
分类:
其他好文 时间:
2014-12-31 06:16:26
阅读次数:
214
question: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 t...
分类:
其他好文 时间:
2014-11-26 23:59:52
阅读次数:
381
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 now [1,1,2,...
分类:
其他好文 时间:
2014-11-25 14:35:41
阅读次数:
150
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in place with...
分类:
其他好文 时间:
2014-11-25 14:34:37
阅读次数:
210