DSA problems
Grouped by pattern, in the order worth learning them. Each problem has hints, the approach, and an editor.
Solved
0/193
01Foundations
- ArraysIn-place index manipulation, single-pass scans and clever reuse of the input array.4 · 8 · 10/13
- StringsCharacter-level parsing, palindromes, rotations and pattern matching on text.3 · 5 · 20/10
- Hashing & mapsTrading memory for speed with hash sets and maps for O(1) lookups and counting.3 · 4 · 10/8
02Core patterns
- Two pointersMoving two indices toward or alongside each other to prune a quadratic search.3 · 4 · 10/8
- Sliding windowGrowing and shrinking a contiguous window to answer subarray and substring questions in one pass.2 · 4 · 20/8
- Prefix sumPrecomputing running totals so any range sum is a subtraction, often paired with a hash map.2 · 3 · 10/6
- Binary searchHalve the search space every step: on sorted data, on rotated arrays, and on the answer itself.3 · 5 · 20/10
- Sorting algorithmsImplementing and adapting merge, quick, counting and bucket sort, and designing custom orderings.1 · 3 · 10/5
- Recursion & backtrackingBuild solutions one choice at a time, explore each branch, and undo the choice before trying the next.1 · 7 · 20/10
03Data structures & graphs
- Linked listsRewire pointers safely: reversal, fast/slow runners, dummy heads, and list-backed data structures.3 · 5 · 20/10
- Stacks & queuesUse LIFO and FIFO order to match brackets, evaluate expressions, and design small data structures.3 · 4 · 10/8
- Monotonic stackKeep a stack in sorted order to find the next greater or smaller element for every position in one pass.1 · 4 · 10/6
- Trees & BSTRecursive thinking on hierarchical data: traversals, height-based DFS, BST ordering, and tree reconstruction.4 · 7 · 30/14
- Heaps / priority queuesPull the smallest or largest item quickly: top-k, streaming medians, and greedy scheduling.2 · 4 · 10/7
- TriesStore words as shared prefix paths to answer prefix, wildcard, and multi-word search queries fast.0 · 3 · 10/4
- GraphsModelling problems as nodes and edges: BFS/DFS, topological sort, union-find, shortest paths, and spanning trees.3 · 8 · 30/14
04DP & advanced
- GreedyMaking the locally best choice at each step, and learning to argue why it stays globally optimal.2 · 5 · 10/8
- Dynamic programmingBreak a problem into overlapping subproblems, define a state, and build answers from smaller ones.3 · 12 · 30/18
- Bit manipulationUse XOR, masks and shifts to solve problems in constant space without extra data structures.3 · 3 · 00/6
- Math & number theorySpot the arithmetic or number-theory insight that turns brute force into a clean formula or loop.2 · 3 · 10/6
- IntervalsSorting ranges by start or end and sweeping through them to merge, insert, or schedule.0 · 4 · 10/5
- Matrix / 2DTraverse and transform 2D grids in place with careful index arithmetic.0 · 5 · 00/5
- Segment tree / FenwickAnswer range queries under point updates in logarithmic time with segment trees and binary indexed trees.0 · 1 · 30/4