The Midpoint Overflow Bug
In binary search, the line mid equals low plus high, divided by two, looks perfectly fine. Why can it be a bug, and how do you fix it?
Comment your answer, then watch the solution.
Follow Brain Massage by CN for a new brain teaser every day
#interviewquestion #brainteaser #logic #puzzle #problemsolving