Binary search and stacks
Binary search on arrays and answers; monotonic stacks and queues.
- DSA.07.01Pattern 5: Binary search (on index and on answer)CoreMid-levelBeing written
- DSA.07.02Pattern 6: Stack and monotonic stack/queueCoreMid-levelBeing written
Interview questions in this module
- Write binary search without off-by-one errors. Explain your loop invariant.
- What does "binary search on the answer" mean? Give an example.
- What is a monotonic stack and what problems does it solve?
- Find the next greater element for every item in O(n).