Mercurial
view grok_interview/binary_search.py @ 56:92b097d70af4
Updated so that fzf works out of the box.
| author | June Park <me@mrjunejune.com> |
|---|---|
| date | Tue, 16 Dec 2025 21:01:45 -0500 |
| parents | 68fa88ac73fe |
| children |
line wrap: on
line source
x = [1,2,3,4,5,9,20,25,33,99] # | | target = 18 left = 0 right = len(x) while left < right: mid = (left + right)//2 if x[mid] == target: break elif x[mid] < target: left = mid + 1 else: right = mid print(x[mid])