← problems
#153

Find Minimum in Rotated Sorted Array

MediumBinary Search

Suppose a sorted ascending array of unique integers was rotated some number of times. Given the rotated array nums, return the minimum element in O(log n).

Example

nums = [3, 4, 5, 1, 2]        => 1
nums = [4, 5, 6, 7, 0, 1, 2]  => 0
Implement
function FindMin(nums: int[]) -> int

Found a bug? Or annoyed about something in the language? Tell us.

loading editor…