Dynamic programming can recover a concrete optimal solution, not only an objective value. This article uses House Robber and longest common subsequence to show how a back array reconstructs the solution.
65 articles
Dynamic programming can recover a concrete optimal solution, not only an objective value. This article uses House Robber and longest common subsequence to show how a back array reconstructs the solution.
Uses longest common subsequence to explain two-dimensional subproblems, recurrences, and space optimization.
Uses House Robber to derive four steps for defining subproblems, recurrences, evaluation order, and space optimization.
Compares DFS and BFS while explaining level-order traversal, shortest paths, and multi-source BFS.
Builds a grid-DFS framework with visitation and boundary handling, then applies it to island problems.
Uses iterative inorder traversal and adjacent nodes in traversal order to solve several binary-tree problems.
Break down two challenging binary-tree problems with a three-step method: define subproblems, recurse, and combine results.
Uses binary-tree diameter to show how a global variable aggregates answers across subtrees during recursion.
Compare the subtle constraints across the Combination Sum family using one backtracking framework for candidates, deduplication, and the DP boundary.
Explains sorting, pruning, and deduplication strategies for subset, permutation, and combination problems with duplicates.