Search for a Range
Total Accepted: 21480 Total
Submissions: 78454My Submissions
Given a sorted array of integers, find the starting and ending position of a given target value.
Your algo...
分类:
其他好文 时间:
2014-10-11 00:15:07
阅读次数:
197
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....
分类:
其他好文 时间:
2014-10-10 23:59:54
阅读次数:
226
题意:一个已经排序好的数组,被按某个位置旋转了一次,给定一个值target,在该旋转后的数组里查找该值。
思路:二分查找
难点在于确定往数组的哪一半段继续二分查找
设起点、中间点、终点分别为 start、middle、end (采用前闭后开的区间表示方法
如果target = A[middle] return middle
如果A[middle] >= A[start],则[start,...
分类:
其他好文 时间:
2014-10-10 23:15:44
阅读次数:
219
Search in Rotated Sorted Array II
Total Accepted: 18500 Total
Submissions: 59945My Submissions
Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
Would this...
分类:
其他好文 时间:
2014-10-10 21:35:14
阅读次数:
239
题目:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space fo...
分类:
其他好文 时间:
2014-10-10 20:19:34
阅读次数:
176
Search in Rotated Sorted Array II
Total Accepted: 18488 Total
Submissions: 59914My Submissions
Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
Would this...
分类:
其他好文 时间:
2014-10-10 17:26:24
阅读次数:
122
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...
分类:
其他好文 时间:
2014-10-10 16:26:13
阅读次数:
141
-(id)performSelector:(SEL)aSelector withObject:(id)anObject withObject:(id)anotherObjectDescription[说明]Sends a message to the receiver with two object...
分类:
其他好文 时间:
2014-10-10 16:00:50
阅读次数:
223
Polymorphism is often referred to as the third pillar of object-oriented programming, after encapsulation and inheritance. It has two distinct aspects:
At run time, objects of a derived class may...
分类:
其他好文 时间:
2014-10-10 14:05:54
阅读次数:
158