The Blind 75 Leetcode Series: Find Minimum in Rotated Sorted Array

Jonathan Chao
5 min readSep 26, 2022
Photo by Chris Ried on Unsplash

Today, we are working on 153. Find Minimum in Rotated Sorted Array

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become:

[4,5,6,7,0,1,2] if it was rotated 4 times.

[0,1,2,4,5,6,7] if it was rotated 7 times.

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]].

Given the sorted rotated array nums of unique elements, return the minimum element of this array.

You must write an algorithm that runs in O(log n) time.

We have a list of unique numbers, rotated at least once and at most n times, where n is the length of the list. The question is not asking us to find the number of times it’s being rotated but simply finding the minimum.

The question itself is actually already pretty self explanatory. Something that might help us include

  1. Do we expect an empty list?

--

--

Jonathan Chao
Jonathan Chao

Written by Jonathan Chao

I am a software developer who has been in this industry for close to a decade. I share my experience to people who are or want to get into the industry

No responses yet