DSA sheet
Grouped by pattern, in the order worth learning them. Each problem opens on LeetCode. Tick it when you can solve it again from scratch, not when you have seen the answer.
Arrays & Hashing
Counting, grouping and lookups in O(1): the base of most other patterns.
- Two SumEasy
- Group AnagramsMedium
- Top K Frequent ElementsMedium
- Product of Array Except SelfMedium
- Longest Consecutive SequenceMedium
Two Pointers
Sorted input or pairs from both ends, without extra space.
- Valid PalindromeEasy
- 3SumMedium
- Container With Most WaterMedium
- Trapping Rain WaterHard
Sliding Window
Best sub-array or substring under a constraint, in one pass.
Binary Search
Search a sorted space, including 'binary search on the answer'.
Linked List
Pointer manipulation and the classic LRU design question.
- Reverse Linked ListEasy
- Linked List CycleEasy
- LRU CacheMedium
- Merge k Sorted ListsHard
Trees
Recursion, BFS and DFS: one of the most asked categories in coding rounds.
Heap / Priority Queue
Top-K, streaming medians and scheduling.
Graphs
BFS, DFS, topological sort and shortest paths.
- Number of IslandsMedium
- Rotting OrangesMedium
- Course ScheduleMedium
- Network Delay TimeMedium
- Word LadderHard
Dynamic Programming
Write the recurrence first, then memoize, then tabulate. Practise saying the state out loud.
- Climbing StairsEasy
- House RobberMedium
- Coin ChangeMedium
- Longest Increasing SubsequenceMedium
- Longest Common SubsequenceMedium
- Partition Equal Subset SumMedium
- Edit DistanceMedium
Intervals
Sort by start, then merge or count overlaps.
- Merge IntervalsMedium
- Non-overlapping IntervalsMedium
Tries
Prefix search, the core of autocomplete (see the Typeahead HLD).