1. 程式人生 > >leetcode-33-Search in Rotated Sorted Array

leetcode-33-Search in Rotated Sorted Array

Use the most understandable method, in binary search, we can know that at least one part is sort in order. Base on that, we just need to care about the part is sorted, if current target is in that part, narrow the index within such range, otherwise go to the other part.

At first I cannot understand such concept, so I just compare the neighbor of the middle point. It is a good lesson for me to learn about binary search.