Leetcode 153 Solution

This article provides solution to leetcode question 153 (find-minimum-in-rotated-sorted-array)

https://leetcode.com/problems/find-minimum-in-rotated-sorted-array

Solution

class Solution: def findMin(self, nums: List[int]) -> int: l = 0 r = len(nums) - 1
while l < r: m = (l + r) // 2 if nums[m] <= nums[-1]: r = m else: l = m + 1 return nums[l]