Skip to main content

153. Find Minimum in Rotated Sorted Array - LeetCode

ยท One min read
class Solution:
def findMin(self, nums: list[int]) -> int:
lo, hi = 0, len(nums)
while lo < hi:
mid = (lo + hi) // 2
if nums[mid] <= nums[-1]:
hi = mid
else:
lo = mid + 1
return nums[lo]