DSA Topics
75 problems across 11 pattern-based topics. Click any card to see all problems with brute force → optimal solutions. Check off problems as you complete them — progress is saved locally.
Arrays & Hashing
HashMap / HashSet for O(1) lookups
Two Pointers
L+R pointers converging; eliminates O(n²) nested loops
Sliding Window
Expand right, shrink left when constraint violated
Binary Search
Sorted/monotonic space → O(log n). Also 'search on answer'.
Stack
LIFO for monotonic problems and expression evaluation
Linked List
Dummy nodes, fast/slow pointers, two-pass technique
Trees
DFS (recursion), BFS (queue), BST property (L < root < R)
Heap / Priority Queue
Min-heap for k-largest; two-heap for running median
Dynamic Programming
Define dp[i] → recurrence → base case → bottom-up
Graphs
DFS/BFS for traversal; Union-Find for connectivity; Topo Sort for DAGs
Greedy & Intervals
Sort + greedy choice; overlapping intervals → sort by start
// Complexity Quick Reference
| Algorithm | Time | Space | When to Use |
|---|---|---|---|
| Binary Search | O(log n) | O(1) | Sorted/monotonic array |
| Two Pointers | O(n) | O(1) | Sorted array, palindrome |
| Sliding Window | O(n) | O(k) | Subarray/substring with constraint |
| DFS / BFS | O(V+E) | O(V) | Graph/tree traversal |
| Merge Sort / Heap Sort | O(n log n) | O(n) | General sorting |
| Dynamic Programming | O(n²)–O(n·m) | O(n)–O(n·m) | Overlapping subproblems |
| Heap operations | O(log n) | O(n) | K-th largest/smallest |
| Trie insert/search | O(L) | O(L·n) | Prefix matching, L=word length |