Given a rotated sorted array of distinct integers, implement a function that returns the index of a target value or -1 if it is not present. The solution must run in O(log n) time, so a linear scan is not acceptable.
Constraints
1 <= nums.length <= 10^5
All values in nums are distinct
nums is sorted in ascending order and rotated at an unknown pivot
-10^4 <= nums[i], target <= 10^4
Interviewer
Whenever you're ready, walk me through your approach or go straight to the code. The requirements are in the Question tab.