The hardest point lies in how to write the if sentence right. Because it is a rotated ascendingly sorted array, there are basic two kinds of conditions.
In each condition, we need to find the right circumstances that we move the h pointer and l pointer. It is a little tricky that in each condition you can only move one pointer instead of two.
Search in Rotated Sorted Array
网友评论