The problem. Like Search in Rotated Sorted Array, but the array may contain duplicates. Given the rotated array nums and a target, return true if the target is in it and false otherwise. Try to keep the number of steps as small as possible.
nums = [2, 5, 6, 0, 0, 1, 2], target = 0 -> true
nums = [2, 5, 6, 0, 0, 1, 2], target = 3 -> false
nums = [1, 0, 1, 1, 1], target = 0 -> trueMembers only · free account
The rest of this lesson, with 6 more sections, 1 drawing, a dry-run simulator and code in JavaScript, Python, Java and C++, opens with a free account.
Not ready yet? The Arrays course is free to read, no account needed.
In the rest of this lesson