Find Minimum in Rotated Sorted Array
Suppose an array of length n sorted in ascending order is rotated between 1 and n times. Find the minimum element of this array.

30:00

Find Minimum in Rotated Sorted Array
medium
Topics
Companies

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. Find the minimum element of this array.

Example 1:
Input: {"nums":[3,4,5,1,2]}
Output: 1
Constraints:
  • n==nums.lengthn == \text{nums.length}

  • 1n50001 \leq n \leq 5000

  • 5000nums[i]5000-5000 \leq \text{nums}[i] \leq 5000

  • All integers in nums are unique.

  • nums is sorted and rotated between 11 and nn times.

Input
arr ={"nums":[3,4,5,1,2]}
Target: 3

3

L

4

5

1

2

R
Variables
No variables to display
DepthFunction Call
Stack empty
0/8