A strictly increasing array was rotated at an unknown position. Given the rotated array and a target, return the target's index.
Return -1 when the target is absent, using logarithmic time.
Inputnums = [4, 5, 6, 7, 0, 1, 2], target = 0
Output4
0 is the fifth element of the rotated array, so its zero-based index is 4.
Inputnums = [4, 5, 6, 7, 0, 1, 2], target = 3
Output-1
The rotated array contains no 3, so the search returns -1.
1 ≤ nums.length ≤ 5,000