DSA practice problems
151 data structures and algorithms problems, grouped by pattern, each with hints and solutions from brute force to optimal.
- Arrays & Hashing: Using arrays and hash tables to track, count, and look up values fast.
- Two Pointers: Walking two positions through a sequence at once, often from both ends inward.
- Sliding Window: Growing and shrinking a window over a sequence to track a running condition.
- Stack: Using last-in-first-out order to match, undo, or track nested structure.
- Binary Search: Cutting a sorted (or sorted-like) search space in half, repeatedly.
- Linked List: Rewiring pointers between nodes instead of shifting array elements.
- Trees: Traversing and reasoning about hierarchical, branching structures.
- Tries: A tree specialized for storing and searching sequences, like words.
- Heap / Priority Queue: Always having fast access to the smallest or largest remaining item.
- Backtracking: Exploring choices one at a time, undoing ones that don't pan out.
- Graphs: Modeling and traversing networks of connected nodes.
- Advanced Graphs: Shortest paths, minimum spanning trees, and topological ordering.
- 1-D Dynamic Programming: Building up an answer from smaller subproblems along one dimension.
- 2-D Dynamic Programming: The same idea as 1-D DP, tracked across two dimensions at once.
- Greedy: Making the locally best choice at each step and trusting it works out.
- Intervals: Comparing and merging ranges that may overlap.
- Math & Geometry: Problems that lean on numeric reasoning or 2D grid geometry.
- Bit Manipulation: Working with the individual binary bits inside a number.