Solution 1: accepted 0ms
use nums[mid] > nums[hi] rather than nums[mid] > nums[lo] to avoid consideration of corner case, no rotation. If there’s no rotation and we say if (nums[mid] > nums[lo]) lo = mid, we abandon the left side, which has the answer.
|
|