binary search, bias to the left
β’ 39 words β’ 1 min β’ updated
Prefer:
python
mid = left + (right - left) // 2Instead of:
python
mid = (left + right) // 2…to avoid a potential integer overflow.
Not a real concern in Python, but still a best, defensive practice.