New intermediate

DSA Patterns Course: Coding Interview Patterns in Python

Free DSA patterns course: two pointers, sliding window maximum, binary search, monotonic stack, heaps, trees, union find, Dijkstra and DP in Python.

Lessons
16
Modules
6
Time
11-13 hours

Your progress

0 of 16 lessons done 0%
Start with Lesson 1
  • Free, no sign-up
  • Progress saved in this browser
  • Code you can copy and run

What you'll learn

  • Recognise which of 16 core patterns an unseen coding problem needs, from its signals and constraints
  • Write two pointers, sliding window and binary search solutions without off-by-one bugs
  • Solve sliding window maximum in O(n) with a monotonic deque and explain why it's linear
  • Use heaps, tree DFS/BFS, graph BFS/DFS, topological sort and Dijkstra confidently
  • Implement union find with path compression and union by size from memory
  • Approach dynamic programming with a state, recurrence, base case and fill order

Course curriculum

16 lessons in 6 modules · 11-13 hours

Arrays and Strings

6 lessons
  1. Lesson 1: How to Learn DSA Patterns + Hash Maps How to study coding interview patterns instead of memorising problems, starting with the hash map pattern: two sum, group anagrams and top-k frequent. 30-40 min beginner
  2. Lesson 2: Two Pointers Pattern Two pointers pattern for sorted and symmetric arrays: pair sum, 3Sum without duplicates and container with most water, with the reasoning for each move. 35-45 min beginner
  3. Lesson 3: Sliding Window Pattern Fixed and variable sliding windows explained: max sum of k elements, longest substring without repeats, and minimum window substring in Python. 40-50 min intermediate
  4. Lesson 4: Sliding Window Maximum (Monotonic Deque) Sliding window maximum in O(n) with a monotonic deque: intuition, a dry run, Python and Java code, and a 2000-case check against brute force. 40-50 min advanced
  5. Lesson 5: Prefix Sum Pattern Prefix sums for O(1) range queries, counting subarrays that sum to k with a hash map (negative numbers too), and product of array except self. 30-40 min intermediate
  6. Lesson 6: Binary Search Pattern (and on the Answer) Binary search beyond sorted arrays: lower bound without off-by-one bugs, rotated sorted arrays, and binary search on the answer (Koko eating bananas). 40-50 min intermediate

Stacks and Linked Lists

2 lessons
  1. Lesson 7: Monotonic Stack Pattern Monotonic stack pattern for next greater element, daily temperatures and largest rectangle in histogram, with why each index is pushed and popped once. 35-45 min intermediate
  2. Lesson 8: Fast and Slow Pointers (Floyd's Cycle) Fast and slow pointers: middle of a linked list, Floyd cycle detection, finding where the cycle starts, and find the duplicate number in O(1) space. 30-40 min intermediate

Trees and Heaps

2 lessons
  1. Lesson 9: Heap Pattern: Top K, Merge K, Median Heap and priority queue patterns: k largest elements with a size-k min-heap, merging k sorted lists, and a running median with two heaps in Python. 35-45 min intermediate
  2. Lesson 10: Tree DFS and BFS Patterns Tree DFS and BFS patterns: what each recursive call returns, max depth, binary tree maximum path sum, level order traversal and validating a BST. 45-55 min intermediate

Intervals, Greedy and Backtracking

2 lessons
  1. Lesson 11: Intervals and Greedy Patterns Interval and greedy patterns: merge intervals, minimum removals for non-overlapping intervals, meeting rooms with a heap, and jump game, in Python. 40-50 min intermediate
  2. Lesson 12: Backtracking Pattern Backtracking pattern with the choose, explore, un-choose template: subsets, permutations, combination sum with pruning, and N-Queens in Python. 45-55 min intermediate

Graphs

3 lessons
  1. Lesson 13: Graph BFS, DFS and Topological Sort Graph traversal patterns: DFS for connected regions (number of islands), BFS for shortest paths in grids, and topological sort with Kahn's algorithm. 45-55 min intermediate
  2. Lesson 14: Union Find (Disjoint Set Union) Explained Union find (disjoint set union) with path compression and union by size: connected components, redundant connection, accounts merge, Python and Java. 45-55 min intermediate
  3. Lesson 15: Dijkstra and Shortest Path Patterns Shortest path patterns: Dijkstra with a min-heap and lazy deletion, network delay time, and Bellman-Ford for cheapest flights within k stops. 40-50 min advanced

Dynamic Programming

1 lesson
  1. Lesson 16: Dynamic Programming Patterns (1D and 2D) Dynamic programming via state, recurrence and fill order: climbing stairs, house robber, coin change, LIS, LCS and edit distance in Python. 55-70 min advanced