5 hands-on exercises and 5 find-the-bug challenges for the Binary Search on the Answer lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Find the smallest eating speed that finishes in eight hours.
Find the largest whole number whose square is at most 17.
Find the first index where the predicate becomes true.
Report whether a predicate list is false then true with no flip back.
Count how many probes a search over sixteen candidates needs.
Setting low to mid rather than mid plus one stalls, so a guard stops it.
Searching for a maximum needs the midpoint rounded up, or it stalls.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceThe answer range is not the array indices here.
Moving low past a true value walks off the boundary.
A predicate that flips back cannot be binary searched.