Post

Binary Search

Binary Search

바이너리 서치

1
2
3
4
5
6
7
8
9
left = 1
right = n
while(left<right):
    mid = left + int((right-left) / 2)
    if isBadVersion(mid):
        right = mid
    else:
        left = mid + 1
return left
This post is licensed under CC BY 4.0 by the author.