Search in Rotated Sorted Array
Updated Feb 24, 2026
Problem
Return index of target in rotated sorted array, else -1.
Constraints
1 <= nums.length <= 5000
Examples
Example 1
Input:
{"nums": [4, 5, 6, 7, 0, 1, 2], "target": 0}
Output:
4
Function Signature
def search(self, nums: list[int], target: int) -> int
How to Submit
Implement a Solution class with a search method.
Your method will be called with the input parameters and should return the answer.