There is an integer array
numsPrior to being passed to your function,
numsk(1 <= k < nums.length)[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]][0,1,2,4,5,6,7]3[4,5,6,7,0,1,2]Given the array
numstargettargetnums-1numsYou must write an algorithm with
O(log n)Example 1:
Input: nums = [4,5,6,7,0,1,2], target = 0
Output: 4Example 2:
Input: nums = [4,5,6,7,0,1,2], target = 3
Output: -1Example 3:
Input: nums = [1], target = 0
Output: -11 <= nums.length <= 5000-10^4 <= nums[i] <= 10^4numsnums-10^4 <= target <= 10^4Solve problems, verify your skills, and earn XP.