Given a rotated sorted array `nums` of distinct values, implement `search(nums, target)` returning the index of `target` or `-1`.
Run your code to see results.