Average two signed integers without overflow
The safe-midpoint trick lo + (hi - lo) // 2 assumes lo <= hi and non-negative indices. But suppose you need the floored average of two arbitrary signed integers, either of which may be near the 32- or 64-bit limit, and you cannot assume any ordering or sign.
Compute with no intermediate that could overflow a fixed-width integer.
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.