$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · hard · #311

What goes in the blank?

// Java: midpoint that cannot overflow int
int mid = lo + (hi - lo) ____ 2;

Answer: / (also accepted: /)

(lo + hi) can exceed Integer.MAX_VALUE; hi - lo cannot. >> 1 would bind after the + and give the wrong value.
Play Problem Solving ▸