Interview
Binary search variations that come up most in interviews
8/4/2025
332
I noticed binary search is one of those topics where the basic concept is easy but variations can be tricky. Here are the ones I've encountered most:
- Search in rotated sorted array
- Find first/last occurrence
- Search in 2D matrix
- Minimum in rotated array
- Capacity to ship packages (binary search on answer)
- Koko eating bananas
- Split array largest sum
The "binary search on answer" pattern (#5-7) seems to be getting more popular. Anyone want to add more?
binary-searchpatternsinterview-prepdsa