Search in Rotated Sorted Array

Medium

📝 Description

Search for target in rotated sorted array

Input Format

Rotated sorted array and target

Output Format

Index or -1

Constraints

1 ≤ nums.length ≤ 5000

🔍 Sample Input

[4,5,6,7,0,1,2]
0
            

✅ Sample Output

4
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run