left
at 1 and right
at n
.left
is less than right
, do the following:
a. Calculate the middle of the current search space as mid = left + (right - left) // 2
.
b. If isBadVersion(mid)
is True
, set right
to mid
.
c. Otherwise, set left
to mid + 1
.left
will be the first bad version.