Pattern
Binary Search
Use binary search when a yes or no question flips from no to yes exactly once along an ordered range. Each answer discards half of what is left. The usual cost is O(log n) time, and the range can be answers, not only items.
1. Binary Searcharray · sorted list · binary searchEasy2. Search a 2D Matrixmatrix · sorted grid · binary searchMed.3. Koko Eating Bananasarray · binary search on the answerMed.4. Find Minimum in Rotated Sorted Arrayarray · rotated list · binary searchMed.5. Search in Rotated Sorted Arrayarray · rotated sorted array · binary searchMed.6. Time Based Key Value Storedesign · hash map · binary searchMed.7. Median of Two Sorted Arraysarray · sorted lists · binary search · medianHard