def find_min(arr):
lo, hi = 0, len(arr) - 1
while lo < hi:
mid = (lo + hi) // 2
if arr[mid] > arr[hi]:
lo = mid + 1
else:
hi = mid
return arr[lo]
Variables
n- length of the rotated sorted array
Explanation
Binary-search variant comparing `mid` to `hi` to decide which half holds the rotation point - **O(log n)** time, **O(1)** space. The naive linear scan would be O(n).