Practice Index

Patterns Implemented

✅ Foundational Patterns

Practice Sessions

Session 1: Two Pointers

Problems: 3 problems, 8 solutions

  • Container With Most Water (LC 11)
  • 3Sum (LC 15)
  • Trapping Rain Water (LC 42)

👉 Practice Session 1

Session 2: Sliding Window

Problems: 4 problems, 6 solutions

  • Minimum Size Subarray Sum (LC 209)
  • Longest Repeating Character Replacement (LC 424)
  • Permutation in String (LC 567)
  • Max Consecutive Ones III (LC 1004)

👉 Practice Session 2

Problems: 5 problems, 8 solutions

  • Find Peak Element (LC 162)
  • Search in 2D Matrix II (LC 240)
  • Koko Eating Bananas (LC 875)
  • Capacity To Ship Packages (LC 1011)
  • Time-Based Key-Value Store (LC 981)

👉 Practice Session 3

Session 4: HashMap

Problems: 5 problems, 8 solutions

  • Top K Frequent Elements (LC 347)
  • Design HashMap (LC 706)
  • Valid Sudoku (LC 36)
  • Insert Delete GetRandom O(1) (LC 380)
  • Copy List with Random Pointer (LC 138)

👉 Practice Session 4

Session 5: Stack & Monotonic Stack

Problems: 5 problems, 9 implementations

  • Valid Parentheses (LC 20)
  • Min Stack (LC 155) — two approaches: two-stack and encoding trick
  • Daily Temperatures (LC 739)
  • Largest Rectangle in Histogram (LC 84)
  • Online Stock Span (LC 901)

👉 Practice Session 5

Session 6: Trees — DFS/BFS

Problems: 5 problems, 10 implementations

  • Maximum Depth of Binary Tree (LC 104) — recursive DFS + iterative BFS
  • Invert Binary Tree (LC 226) — recursive DFS + iterative BFS
  • Binary Tree Level Order Traversal (LC 102) — DFS with depth + BFS with level segmentation
  • Lowest Common Ancestor (LC 236) — BFS parent map + recursive postorder DFS
  • Binary Tree Maximum Path Sum (LC 124) — brute force per-node + single-pass postorder DFS

👉 Practice Session 6

Session 7: Heap / Priority Queue

Problems: 5 problems, 11 implementations

  • Kth Largest Element in an Array (LC 215) — sort + min-heap of size k
  • Find Median from Data Stream (LC 295) — sorted insertion + two-heap (max-left / min-right)
  • Merge K Sorted Lists (LC 23) — flatten+sort + min-heap over k heads
  • Task Scheduler (LC 621) — cycle simulation + max-heap with cooldown queue + math closed-form
  • IPO / Maximum Capital (LC 502) — linear scan + two-heap greedy (capital gate + profit selector)

👉 Practice Session 7

Session 8: Graph — BFS, DFS, Topological Sort

Problems: 5 problems, 10 implementations

  • Number of Islands (LC 200) — DFS flood-fill + BFS with visited matrix
  • Clone Graph (LC 133) — DFS with HashMap + BFS variant
  • Course Schedule (LC 207) — DFS 3-colour cycle detection + Kahn’s BFS topological sort
  • Pacific Atlantic Water Flow (LC 417) — reverse DFS from both oceans + multi-source BFS
  • Word Ladder (LC 127) — naive BFS (26-char scan) + BFS with prebuilt pattern buckets

👉 Practice Session 8

Session 9: Dynamic Programming 1D

Problems: 5 problems, 16 implementations

  • Climbing Stairs (LC 70) — naive recursion + memoization + bottom-up DP + O(1) space rolling variables
  • House Robber (LC 198) — naive recursion + memoization + bottom-up DP + O(1) space rolling variables
  • Longest Increasing Subsequence (LC 300) — O(n²) DP + O(n log n) patience sorting with binary search
  • Coin Change (LC 322) — top-down memoization + bottom-up DP (BFS-graph interpretation)
  • Word Break (LC 139) — brute recursion + memoization + boolean array DP + BFS approach

👉 Practice Session 9

Session 10: Dynamic Programming 2D

Problems: 5 problems, 12 implementations

  • Unique Paths (LC 62) — naive recursion + 2D DP table + 1D rolling array + combinatorics O(1)
  • Longest Common Subsequence (LC 1143) — naive recursion + 2D DP + space-optimized two-row
  • Edit Distance (LC 72) — naive recursion + 2D DP (Levenshtein matrix) + space-optimized two-row
  • Coin Change II (LC 518) — 2D DP combinations count (unbounded knapsack) + space-optimized 1D
  • Burst Balloons (LC 312) — interval DP memoized top-down + interval DP bottom-up by length

👉 Practice Session 10

Session 11: Backtracking

Problems: 5 problems, 10 implementations

  • Subsets (LC 78) — iterative bit-mask + recursive backtracking
  • Permutations (LC 46) — swap-based generation + backtracking with used[] array
  • Combination Sum (LC 39) — unsorted backtracking + sort + early-exit pruning
  • N-Queens (LC 51) — O(n) conflict scan + O(1) column/diagonal conflict sets
  • Word Search (LC 79) — DFS with explicit visited[][] + in-place sentinel marking

👉 Practice Session 11

Session 12: Greedy Algorithms

Problems: 5 problems, 10 implementations

  • Jump Game (LC 55) — DP reachability + O(n) greedy maxReach scan
  • Jump Game II (LC 45) — BFS level expansion + O(n) greedy implicit-layers (farthest reach)
  • Meeting Rooms II (LC 253) — sort + min-heap room counter + sweep-line event-based approach
  • Gas Station (LC 134) — brute force try-each-start + single-pass greedy (total + running sum)
  • Non-overlapping Intervals (LC 435) — activity selection DP + sort-by-end greedy (Earliest Deadline First)

👉 Practice Session 12

Session 13: Tries (Prefix Trees)

Problems: 3 problems, 5 implementations

  • Implement Trie / Prefix Tree (LC 208) — array[26]-children Trie + HashMap-children Trie
  • Add and Search Word (LC 211) — brute HashSet + Trie with DFS wildcard (’.’)
  • Word Search II (LC 212) — brute per-word DFS + Trie + grid backtracking with branch pruning

👉 Practice Session 13

Session 14: Advanced Graphs — Dijkstra, Union-Find, Topological Sort

Problems: 5 problems, 10 implementations

  • Network Delay Time (LC 743) — Bellman-Ford O(VE) + Dijkstra with min-heap O((V+E)logV)
  • Number of Connected Components (LC 323) — DFS + Union-Find with path compression and union by rank
  • Redundant Connection (LC 684) — DFS cycle detection + Union-Find (detect cycle as edges arrive)
  • Cheapest Flights Within K Stops (LC 787) — Bellman-Ford K-round + Dijkstra with (node, stops) state
  • Alien Dictionary (LC 269) — Kahn’s BFS topological sort + DFS reverse post-order

👉 Practice Session 14

By Difficulty

Easy (Good for Warm-up)

  • Two Sum (HashMap - implicit in pattern)
  • Valid Palindrome (Two Pointers)
  • Binary Search (Binary Search)

Medium (Core Interview)

  • Container With Most Water (Two Pointers)
  • Longest Substring Without Repeating (Sliding Window)
  • 3Sum (Two Pointers)
  • Top K Frequent Elements (HashMap + Heap/Bucket)
  • Search in Rotated Sorted Array (Binary Search)
  • Group Anagrams (HashMap)

Hard (Advanced)

  • Trapping Rain Water (Two Pointers/Stack/DP)
  • Minimum Window Substring (Sliding Window)
  • Network Delay Time (Dijkstra / Bellman-Ford)
  • Cheapest Flights Within K Stops (Constrained Dijkstra / Bellman-Ford K-round)
  • Alien Dictionary (Topological Sort from implicit constraints)

By Industry Application

Backend Engineering

  • LRU Cache (HashMap + DLL) → Caching systems
  • Rate Limiting (Sliding Window) → API throttling
  • Binary Search on Answer → Capacity planning

Data Engineering

  • Top K Frequent (HashMap + Heap) → Analytics
  • Sliding Window → Time-series analysis
  • Deduplication (HashMap) → ETL pipelines

Distributed Systems

  • Consistent Hashing (Binary Search) → Load balancing
  • Time-Based Store (HashMap + BS) → Version control
  • Union-Find → Network partition detection, deadlock detection in RDBMS
  • Dijkstra → OSPF link-state routing protocol, Google Maps navigation

General

  • Two Pointers → Memory management, merging
  • Binary Search → Database indexing
  • Graph algorithms → Social networks, dependencies
  • Topological Sort → Webpack module bundling, Airflow DAG scheduling

Study Plan Suggestions

Week 1: Arrays & Strings

  • Days 1-2: Two Pointers (Session 1)
  • Days 3-4: Sliding Window (Session 2)
  • Day 5: Mixed practice
  • Days 6-7: Review & harder problems

Week 2: Search & Lookup

  • Days 1-2: Binary Search (Session 3)
  • Days 3-4: HashMap (Session 4)
  • Day 5: Mixed practice
  • Days 6-7: System design integration

Week 3: Trees & Stacks

  • Days 1-2: Stack & Monotonic Stack (Session 5)
  • Days 3-5: Trees DFS/BFS (Session 6)
  • Days 6-7: Heap/Priority Queue (Session 7)

Week 4: Graphs & DP

  • Days 1-2: Graph BFS/DFS (Session 8)
  • Days 3-5: Dynamic Programming 1D (Session 9)
  • Days 6-7: Dynamic Programming 2D (Session 10)

Week 5: Advanced Patterns

  • Days 1-2: Backtracking (Session 11)
  • Days 3-4: Greedy Algorithms (Session 12)
  • Day 5: Tries (Session 13)
  • Days 6-7: Advanced Graphs — Dijkstra, Union-Find (Session 14)

Progress Tracking

Create a simple log:

Date: 2026-04-09
Problem: Container With Most Water
Status: ✅ Solved (after hint)
Time: 25 min
Complexity: Analyzed correctly
Notes: Initially tried brute force, recognized pattern after thinking about optimization

Additional Resources


Remember: The goal isn’t to memorize solutions, but to recognize patterns and understand tradeoffs!