Mercurial
view grok_interview/binary_search.py @ 64:a30944e5719e
Added vibe coded markdown to html script since it is useful for me. Updated Dowa so that it can be compiled without dirnet for windows.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Tue, 23 Dec 2025 15:18:46 -0800 |
| 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])