DSA tutorials
277 articles · page 9 of 14Hand-written tutorials, ordered as a recommended learning path.
- 161 Word Search & Boggle Solve word search with DFS backtracking, Boggle with Trie pruning, and word ladder with BFS for efficient string transformation problems.
- 162 Validate BST The seductive wrong answer, the correct min/max bounds approach, and how to defend it in an interview.
- 163 LCA of BST Why BST ordering collapses LCA into a one-line traversal, and the iterative version that needs zero extra space.
- 164 Kth Smallest BST The inorder traversal trick, the iterative early-exit version, and the follow-up that haunts FAANG interviews.
- 165 Serialize Tree The preorder-with-nulls encoding, the iterator-driven decoder, and why level-order is a worse choice than it looks.
- 166 Path Sum The DFS-with-decrement trick, why the leaf condition is the whole problem, and the variants that build on it.
- 167 Alien Dictionary Derive character ordering from sorted alien words using topological sort, with course schedule variants and prerequisite chain problems.
- 168 Level Order The queue-with-size BFS pattern, why DFS still works, and how this template extends to zigzag and right-side view.
- 169 Clone Graph Why a hash map from original to copy is the entire idea, plus the BFS variant for stack-limited environments.
- 170 Pacific Atlantic Why reverse traversal beats per-cell flood fill, and how the intersection of two reach sets gives the answer.
- 171 Word Ladder The wildcard-pattern adjacency trick, why BFS is mandatory, and the bidirectional speedup.
- 172 LIS Longest Increasing Subsequence in detail — the O(n^2) DP, the O(n log n) patience-sorting trick with binary search, and when each one matters.
- 173 Negative Cycles Learn how to detect negative cycles using Bellman-Ford's nth relaxation, SPFA algorithm, and apply it to arbitrage detection in currency exchange graphs.
- 174 Edit Distance Edit Distance fully unpacked — the three-operation recurrence, the 2D table, and the rolling-array space optimization that makes interviewers nod.
- 175 Unique Paths Unique Paths in two ways — the O(m * n) grid DP that interviewers expect and the binomial-coefficient closed form that surprises them.
- 176 MST Applications Explore MST applications in network design, clustering, and competitive programming with second-best MST, critical edges, and minimum cost to connect points.
- 177 Flood Fill Master flood fill, surrounded regions, number of enclaves, and Pacific Atlantic water flow using DFS and BFS grid traversal techniques in Python.
- 178 Clone & Transform Learn to clone graphs with BFS and DFS, validate graph trees, find minimum height trees via centroid decomposition, and reconstruct itineraries with Hierholzer's algorithm.
- 179 Graph Interview Guide Master the top 20 graph interview patterns with a BFS vs DFS decision flowchart, Union-Find strategies, grid vs adjacency list trade-offs, and template code.
- 180 Palindrome Patterns Master palindrome problems — longest palindromic substring with expand-around-center and Manacher's algorithm, counting palindromic substrings, and palindrome partitioning.