19. Search in Rotated Sorted Array
The integer array nums was sorted in ascending order and then rotated. Find the index of target in O(log n) time, or return -1 if it is absent.
Example 1:
Input: nums = [4,5,6,7,0,1,2], target = 0 Output: 4
Example 2:
Input: nums = [4,5,6,7,0,1,2], target = 3 Output: -1
Constraints:
1 <= nums.length <= 5000All values in nums are unique.