111. Search in Rotated Sorted Array

Given a rotated sorted array nums and target, return the index of the element or -1.
Example 1
Input: nums = [4,5,6,7,0,1,2], target = 3
Output: -1
Explanation: 3 is not in the array.
Example 2
Input: nums = [4,5,6,7,0,1,2], target = 0
Output: 4
Explanation: 0 is at index 4.
arraysbinary searchmedium
JavaScript
Loading...
Line 1, Char 1