Solvarch
DSA ProblemsProgressPlanRoadmapsReviewCheat SheetsCompaniesSystem DesignCS FundamentalsQuestion Bank
Theme
Problems

Find Minimum in Rotated Sorted Array

Medium
binary-searcharray

A sorted array of distinct integers was rotated between 1 and n times. Find the minimum element in O(log n).

Input: one line of space-separated integers (rotated sorted, distinct). Output: the minimum value.

Example 1
Input:
3 4 5 1 2
Output:
1
Example 2
Input:
4 5 6 7 0 1 2
Output:
0
Example 3
Input:
11 13 15 17
Output:
11

Constraints

  • 1 ≤ nums.length ≤ 5000
  • Distinct values.
Watch a video walkthrough

Run your code against the sample tests, or Submit to run the full suite.