131. Find Minimum in Rotated Sorted Array II

HardArrayArray

Given a rotated sorted array that may contain duplicates, return its minimum element.

Input: An integer array.

Output: Integer — minimum element.

Examples

Example 1
Input: [1,3,5]
Output: 1
Explanation: Min is 1.
Example 2
Input: [2,2,2,0,1]
Output: 0
Explanation: Min is 0.
Example 3
Input: [3,4,5,1,2]
Output: 1
Explanation: Min is 1.

Constraints

Asked by

MicrosoftGoogleAmazonMeta
Solve this problem in the editor →