Back to DSA

Find Minimum in Rotated Sorted Array

medium
Acceptance: 48%
Binary Search

A sorted array of distinct values has been rotated some number of times. Locate the smallest element in O(log n) time.

Examples

Example 1:
Input:nums = [6,7,8,1,2,3]
Output:1
Explanation: The rotation point is at value 1.
Example 2:
Input:nums = [2,3,4,5,1]
Output:1
Explanation: The array was rotated so that 1 ended up at the last position.

Hints

00:00
1234567