Why does mid = (left + right) / 2 fail in Binary Search and how do you fix it?
In fixed-width signed 32-bit languages (Java/C++), adding left + right when both exceed 1.07 billion overflows Integer.MAX_VALUE negative and crashes indexing; computing left + (right - left) / 2 or (left + right) >>> 1 prevents overflow while keeping O(log n) time.