Grab's mobile systems may receive sorted identifier data that has been rotated when batches are partitioned or refreshed. Given a rotated sorted array of distinct integers, return the index of a target value using binary search.
The array was originally sorted in strictly increasing order, then rotated at an unknown position. Return -1 if the target is not present.
Implement search(nums, target).
nums, a list of distinct integers, and target, an integer.target in nums, or -1 when it is absent.def search(nums, target):