A sorted array of **distinct** integers has been rotated at an unknown pivot (e.g. `[0,1,2,4,5,6,7]` might become `[4,5,6,7,0,1,2]`). Implement `search(nums, target)` returning the index of `target`, or `-1` if it is absent. Aim for O(log n).
+ 2 hidden tests run on Submit.
Even after rotation, a binary-search step always has at least one sorted half. Determine which half is sorted, test whether the target falls inside its range, and discard the other half. O(log n).
Run your code to see results.