Arrays & Hashing
Store what you have already seen in a hash map or set, so each lookup takes constant time instead of a rescan. Reach for it when a problem asks about duplicates, counts, pairs or complements, as in Two Sum. It usually turns a nested loop into a single pass.
22 problems · 16 with a video · 3 to practice in an AI round
| # | Problem | Difficulty | Video | AI round |
|---|---|---|---|---|
| 1 | Two Sum | Easy | AI round | |
| 2 | Longest Consecutive Sequence | Medium | AI round | |
| 3 | Majority Element | Easy | AI round | |
| 4 | First Missing Positive | Hard | ||
| 5 | Spiral Matrix | Medium | ||
| 6 | Set Matrix Zeroes | Medium | ||
| 7 | Valid Sudoku | Medium | — | |
| 8 | Isomorphic Strings | Easy | ||
| 9 | Find All Numbers Disappeared in an Array | Easy | ||
| 10 | Max Consecutive Ones | Easy | ||
| 11 | Game of Life | Medium | — | |
| 12 | Length of Last Word | Easy | ||
| 13 | Ransom Note | Easy | ||
| 14 | Jewels and Stones | Very easy | ||
| 15 | Check if Array Is Sorted and Rotated | Easy | — | |
| 16 | Kids With the Greatest Number of Candies | Very easy | — | |
| 17 | Concatenation of Array | Very easy | — | |
| 18 | Matrix Diagonal Sum | Very easy | ||
| 19 | Check if the Sentence Is Pangram | Very easy | ||
| 20 | Shuffle String | Very easy | ||
| 21 | Sum of Unique Elements | Very easy | ||
| 22 | Shortest Word Distance | Easy | — |
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
Three of these are AI rounds: 30 minutes, an AI agent beside your code, then a scored report.
Practice Two Sum in an AI roundYour first AI round is free.