Back to course home

0% completed

# Find Minimum in Rotated Sorted Array (Medium)

## Problem Statement

You have an array of length `n`

, which was initially sorted in ascending order. This array was then rotated `x`

times. It is given that 1 <= `x`

<= n. For example, if you rotate `[1, 2, 3, 4]`

array `3`

times, resultant array is `[2, 3, 4, 1]`

.

Your task is to find the minimum element from this array. Note that the array contains unique elements.

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

time.

**Example 1:**

**Input:**[8, 1, 3, 4, 5]**Expected Output:**1**Justification:**The smallest number in the array is 1.

**Example 2:**

.....

.....

.....

Like the course? Get enrolled and start learning!