← Whiteboard questions

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.

Binary Search interview questions and solutions