Leetcode 153 Solution
This article provides solution to leetcode question 153 (find-minimum-in-rotated-sorted-array)
Access this page by simply typing in "lcs 153" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
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]