Search in Rotated Sorted Array II
Problem statement
An integer array was sorted in nondecreasing order and then rotated at an unknown position. The array may contain duplicates.
Given nums and target, return whether target occurs in nums.
Function
search(nums: int[], target: int) → booleanExamples
Example 1
nums = [2,5,6,0,0,1,2]target = 0return = trueZero occurs at the rotation boundary.
Example 2
nums = [2,5,6,0,0,1,2]target = 3return = falseThree is absent.
Constraints
1 <= nums.length <= 10^5.- All values and target are signed 32-bit integers.