https://oj.leetcode.com/problems/remove-duplicates-from-sorted-array/http://fisherlei.blogspot.com/2012/12/leetcode-remove-duplicates-from-sorted.htmlpublicclassSolution{
publicintremoveDuplicates(int[]A){
if(A==null||A.length==0)
return0;//Invalidinput.
..
分类:
其他好文 时间:
2015-01-02 16:12:07
阅读次数:
118
Search in Rotated Sorted ArraySuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2)....
分类:
其他好文 时间:
2015-01-01 21:09:31
阅读次数:
234
Search in Rotated Sorted Array IIFollow up for "LeetCode: Search in Rotated Sorted Array 解题报告":What ifduplicatesare allowed?Would this affect the run-...
分类:
其他好文 时间:
2015-01-01 21:07:17
阅读次数:
240
Search Insert PositionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if ...
分类:
其他好文 时间:
2015-01-01 01:26:32
阅读次数:
155
二分,各种情况。class Solution {public: int findMin(vector &num) { int size = num.size(); int minVal = num[size-1]; findMinRe(num, 0, ...
分类:
其他好文 时间:
2015-01-01 00:00:40
阅读次数:
218
Missing RangesGiven a sorted integer array where the range of elements are [lower, upper] inclusive, return its missing ranges.For example, given [0, ...
分类:
其他好文 时间:
2014-12-31 17:39:21
阅读次数:
110
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.分析:对于BST,左右子树的高度差小于等于1,则在由sorted array构建BST时把数组中间元素作为...
分类:
其他好文 时间:
2014-12-31 16:04:01
阅读次数:
198
Missing Ranges
Total Accepted: 510
Total Submissions: 2300
Given a sorted integer array where the range of elements are [lower,
upper] inclusive, return its missing ranges.
For example, giv...
分类:
其他好文 时间:
2014-12-31 10:06:44
阅读次数:
368
Two Sum II - Input array is sorted
Total Accepted: 441
Total Submissions: 1017
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a...
分类:
其他好文 时间:
2014-12-31 08:43:53
阅读次数:
164
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ...
分类:
其他好文 时间:
2014-12-31 06:21:14
阅读次数:
281