DOKICODE
Study room

Binary Search

Binary search halves a sorted range at every step until one value is left. The harder part is noticing when a problem hides a sorted order you can search over, like the slowest eating speed in Koko Eating Bananas or the largest minimum gap in Magnetic Force Between Two Balls.

The four chapters go from searching a sorted array, to binary search on the answer, to ternary search on functions with a single peak, and end with mixed problems. Take it after the sliding window plan, or on its own if binary search on the answer still feels like guesswork.

103 problemsRating 1477–28064 Chapters
Open the study room

Want company while you work through this list? Sign in, open the study room, and your heroine will bring you the problems one at a time.

I. Binary Search

II. Binary Search on Answer

§2.3 Binary Search on an Indirect Value

ProblemRating
3143. Maximum Points Inside the Square1697
1648. Sell Diminishing Valued Colored Balls2050

III. Ternary Search

Ternary Search

ProblemRating
1515. Best Position for a Service Centre2157

IV. Miscellaneous

The route suggests this plan after Sliding Window & Two Pointers, but the order is not a lock, and your heroine still brings the next unsolved problem one at a time.

Ratings come from zerotrac's LeetCode contest ratings. Some problems have no zerotrac rating and are marked Unrated.

Open the study room