Medium

Quiz

#81 Search in Rotated Sorted Array II

APPROACH

An integer array sorted in non-decreasing order (possibly with duplicates) was rotated at an unknown pivot. Determine whether target exists in the rotated array, reducing operations as much as possible.

Example 1:

Input: nums = [2,5,6,0,0,1,2], target = 0
Output: true

Example 2:

Input: nums = [2,5,6,0,0,1,2], target = 3
Output: false
1 of 4
1:00

What is the optimal approach for this problem?