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#

#SectionCore Patterns
1Arrays & StringsTwo pointers, sliding window, prefix sums, Kadane’s algorithm
2Hashmaps & SetsFrequency counting, two-sum, anagram detection, grouping
3Linked ListsFast/slow pointers, reversal, merge operations, sentinel nodes
4Stacks & QueuesMonotonic stack, valid parentheses, BFS, deque patterns
5TreesDFS/BFS traversals, BST operations, LCA, path problems
6Heaps & Priority QueuesTop-K, merge K sorted, median of stream, task scheduler
7BacktrackingPermutations, combinations, subsets, N-queens, pruning
8Binary 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#

  1. Read the pattern — understand the template and when it applies
  2. Study the examples — trace through the code mentally before running it
  3. Solve variations — each section links to practice problems
  4. 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#

ComplexityNameExample
O(1)ConstantHash table lookup
O(log n)LogarithmicBinary search
O(n)LinearSingle pass through array
O(n log n)LinearithmicMerge sort, heap operations on n items
O(n²)QuadraticNested loops (brute force)
O(2ⁿ)ExponentialSubsets, recursive backtracking
O(n!)FactorialPermutations