Find Minimum in Rotated Sorted Array

Suppose a sorted array is rotated at some pivot. Find the minimum element.

Input Format

nums = rotated sorted array

Output Format

minimum element

Constraints

  • 1 <= nums.length <= 10^5; -10^4 <= nums[i] <= 10^4; all values unique

Examples

Example 1:

Input:

nums = [3,4,5,1,2]

Output:

1

Explanation:

Minimum is 1.

Loading...
Find Minimum in Rotated Sorted Array - Arrays