There is an integer array nums sorted in ascending order with distinct values, but it may be rotated at some pivot.
Return the index of target if it is in nums, or -1 otherwise.
The input or answer space has an order you can cut in half. Define what makes a midpoint too small, too large, or good enough before writing the loop.
Examples
Input: nums = [4,5,6,7,0,1,2], target = 0 Output: 4
Input: nums = [4,5,6,7,0,1,2], target = 3 Output: -1
Constraints
- 1 <= nums.length <= 5,000
- -10,000 <= nums[i], target <= 10,000
- All values are unique.