Find Minimum in Rotated Sorted Array

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. Given the sorted rotated array of unique elements, return the minimum element of this array. The algorithm must run in O(log n) time.

Constraints

  • n == nums.length
  • 1 <= n <= 5000
  • -5000 <= nums[i] <= 5000
  • All the integers of nums are unique.
  • nums is sorted and rotated between 1 and n times.
Saving… · 2 lines
class Solution:
def findMinimumInRotatedSortedArray(self, nums: List[int]) -> int:
Console

Click Run to execute sample tests.