Workspace Search On Answer
0d
Problem-solving patterns

Binary Search on the Answer

Search candidate answer values using a monotone feasibility check.

Recognition signal

Feasible candidates form a prefix or suffix of an ordered range.

Method

Prove monotonicity, set inclusive answer limits, then find the transition.

Worked example

The largest whole r with r² ≤ 20 is 4. The test turns false from 5 onward.

Common mistake

An expensive feasibility check contributes to total time on every probe.