Bootcamps
Masterclasses
Menu
Courses
Account
Login / Sign Up

Find Minimum In Rotated Sorted Array

Medium Acceptance 89% Points 30

Given a rotated sorted array of distinct integers, return the minimum element in the array. The array was originally sorted in ascending order and then rotated at some unknown pivot. The task is to find the smallest element efficiently

Examples
Example 1

Example 1

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

Output: 1

Explanation: The original sorted array was [1,2,3,4,5], which was rotated. The smallest element is 1.

Example 2

Example 2

Input: nums = [4,5,6,7,0,1,2]

Output: 0

Explanation: The smallest element in the rotated array is 0.

Example 3

Example 3

Input: nums = [11,13,15,17]

Output: 11

Explanation: The array is already sorted and not rotated. The first element is the minimum.

Constraints
  • 1 = nums.length = 105
  • -104 = nums[i] = 104
  • All values in nums are distinct
Topics
Recursion
Companies
Apple
Added 19 Jul 2026 89% acceptance
Ln 1, Col 1Sign in to save your code
3 4 5 1 2
1