19. Search in Rotated Sorted Array
The integer array nums was sorted in ascending order and then rotated. Find the index of target in O(log n) time, or return -1 if it is absent.
उदाहरण 1:
इनपुट: nums = [4,5,6,7,0,1,2], target = 0 आउटपुट: 4
उदाहरण 2:
इनपुट: nums = [4,5,6,7,0,1,2], target = 3 आउटपुट: -1
सीमाएँ:
1 <= nums.length <= 5000All values in nums are unique.