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

Arrays & Hashing problems
#ProblemDifficultyVideoAI round
1Two SumEasyAI round
2Longest Consecutive SequenceMediumAI round
3Majority ElementEasyAI round
4First Missing PositiveHard
5Spiral MatrixMedium
6Set Matrix ZeroesMedium
7Valid SudokuMedium—
8Isomorphic StringsEasy
9Find All Numbers Disappeared in an ArrayEasy
10Max Consecutive OnesEasy
11Game of LifeMedium—
12Length of Last WordEasy
13Ransom NoteEasy
14Jewels and StonesVery easy
15Check if Array Is Sorted and RotatedEasy—
16Kids With the Greatest Number of CandiesVery easy—
17Concatenation of ArrayVery easy—
18Matrix Diagonal SumVery easy
19Check if the Sentence Is PangramVery easy
20Shuffle StringVery easy
21Sum of Unique ElementsVery easy
22Shortest Word DistanceEasy—

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 round