DSA Interview Prep#
A focused, pattern-driven guide to data structures and algorithms for technical interviews. Rather than memorising hundreds of problems, this path teaches you the underlying patterns that let you recognise and solve new problems on sight.
What You’ll Learn#
| # | Section | Core Patterns |
|---|
| 1 | Arrays & Strings | Two pointers, sliding window, prefix sums, Kadane’s algorithm |
| 2 | Hashmaps & Sets | Frequency counting, two-sum, anagram detection, grouping |
| 3 | Linked Lists | Fast/slow pointers, reversal, merge operations, sentinel nodes |
| 4 | Stacks & Queues | Monotonic stack, valid parentheses, BFS, deque patterns |
| 5 | Trees | DFS/BFS traversals, BST operations, LCA, path problems |
| 6 | Heaps & Priority Queues | Top-K, merge K sorted, median of stream, task scheduler |
| 7 | Backtracking | Permutations, combinations, subsets, N-queens, pruning |
| 8 | Binary Search (Advanced) | Search space, bisect on answer, rotated arrays, 2D search |
Prerequisites#
- Comfortable writing code in at least one language (examples use Python)
- Basic understanding of time/space complexity (Big-O notation)
- Familiarity with fundamental data structures (arrays, lists, dictionaries)
- Ability to reason about loops, recursion, and basic control flow
How to Use This Path#
- Read the pattern — understand the template and when it applies
- Study the examples — trace through the code mentally before running it
- Solve variations — each section links to practice problems
- Time yourself — aim for 20-30 minutes per medium problem once patterns are familiar
- LeetCode — largest problem set, company-tagged
- NeetCode — curated 150 problems grouped by pattern
- AlgoExpert — video explanations and categorised problems
Complexity Quick Reference#
| Complexity | Name | Example |
|---|
| O(1) | Constant | Hash table lookup |
| O(log n) | Logarithmic | Binary search |
| O(n) | Linear | Single pass through array |
| O(n log n) | Linearithmic | Merge sort, heap operations on n items |
| O(n²) | Quadratic | Nested loops (brute force) |
| O(2ⁿ) | Exponential | Subsets, recursive backtracking |
| O(n!) | Factorial | Permutations |