Binary Search
Halve the search range at every step by asking a question whose answer tells you which half to keep. Look for sorted or rotated data, or an answer you can test as 'too small or big enough', as in Koko Eating Bananas. It cuts linear work down to logarithmic.
23 problems · 12 with a video · 4 to practice in an AI round
| # | Problem | Difficulty | Video | AI round |
|---|---|---|---|---|
| 1 | Median of Two Sorted Arrays | Hard | AI round | |
| 2 | Search in Rotated Sorted Array | Medium | AI round | |
| 3 | Find First and Last Position of Element in Sorted Array | Medium | AI round | |
| 4 | Search Insert Position | Easy | ||
| 5 | Search a 2D Matrix | Medium | ||
| 6 | Find Minimum in Rotated Sorted Array | Medium | ||
| 7 | Find Peak Element | Medium | — | |
| 8 | Missing Number | Easy | ||
| 9 | Koko Eating Bananas | Medium | AI round | |
| 10 | Binary Search | Easy | ||
| 11 | Single Element in a Sorted Array | Medium | — | |
| 12 | Search a 2D Matrix II | Medium | — | |
| 13 | Capacity To Ship Packages Within D Days | Medium | ||
| 14 | Kth Smallest Element in a Sorted Matrix | Medium | — | |
| 15 | Sqrt(x) | Easy | — | |
| 16 | Search in Rotated Sorted Array II | Medium | — | |
| 17 | First Bad Version | Easy | — | |
| 18 | Peak Index in a Mountain Array | Medium | — | |
| 19 | Kth Missing Positive Number | Easy | ||
| 20 | Minimum Number of Days to Make m Bouquets | Medium | — | |
| 21 | Valid Perfect Square | Easy | ||
| 22 | Find the Smallest Divisor Given a Threshold | Medium | — | |
| 23 | Missing Element in Sorted Array | Medium | — |
Sort by what interviews ask
Sign in to see how many companies ask each problem, sort all 500 by it or by likes, and tick off what you solve.
Practice in an AI round
Four of these are AI rounds: 30 minutes, an AI agent beside your code, then a scored report.
Practice Median of Two Sorted Arrays in an AI roundYour first AI round is free.