leetcode 33[medium]---Search in Rotated Sorted Array
难度:medium
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7
might become 4
5 6 7 0 1 2
).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You may assume no duplicate exists in the array.
如果用遍历序列的方法,或者双支针的方法从头尾双向查找都会超时。显然需用两分法缩小查找范围,然后双支针查找。