Question DSA-SRCH-0016
HardWhat is the output of this code?
a = [1, 2, 3, 1]
lo, hi = 0, len(a) - 1
while lo < hi:
mid = (lo + hi) // 2
if a[mid] < a[mid + 1]:
lo = mid + 1
else:
hi = mid
print(lo)
- A.
1
- B.
2
- C.
Sign up free to see the answer and a step-by-step explanation.