Given a rotated sorted sequence of distinct integers and a target value, find the index of the target in the sequence if it exists, otherwise return -1. The sequence was originally sorted in ascending order but has been rotated an unknown number of times.
Explanation: The target value 31 is found at index 1 in the rotated sequence.
Explanation: The target value 9 is found at index 2 in the rotated sequence.
Explanation: The target value 17 is found at index 1 in the rotated sequence.
Explanation: The target value 0 is not found in the sequence.
Binary search with rotation pivot
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak