Guided Lesson Notes
Understanding Longest Common Subsequence
Longest Common Subsequence focuses on overlapping subproblems, reusable answers, and turning recursion into a table or memo. Longest common subsequence is a classic DP problem that compares two sequences while allowing skipped characters.
Model: define one state as a smaller question whose answer can help build larger answers.
Invariant: when a state is used, every smaller state it depends on must already be correct or memoized.
Implementation: state definitions, recurrence formulas, base cases, table order, memoization maps, and reconstruction when needed.
Use Longest Common Subsequence when the problem asks for best, count, longest, shortest, ways, or choices over prefixes, positions, capacities, or subsets.
