Concepts32
Digit DP - Advanced States
Digit DP counts integers in a range by scanning digits from most significant to least while maintaining compact state information.
DP with Probability
DP with probability models how chance flows between states over time by repeatedly redistributing mass according to transition probabilities.
Interval DP
Interval DP solves problems where the optimal answer for a segment [i, j] depends on answers of its subsegments.
Tree DP - Rerooting Technique
Rerooting (a.k.a. 换根 DP) computes a per-node answer as if each node were the root, in total O(n) time on trees.
Digit DP
Digit DP is a dynamic programming technique for counting or aggregating values over all integers in a range that satisfy a digit-based property.
Tree DP - Matching and Covering
Tree DP solves matching, vertex cover, and independent set on trees in linear time using small state transitions per node.
Bitmask DP
Bitmask DP compresses the state of a subset of n elements into an integer mask, enabling elegant dynamic programming over all subsets.
Longest Common Subsequence
The Longest Common Subsequence (LCS) between two sequences is the longest sequence that appears in both, not necessarily contiguously.
Bitmask DP - Subset Enumeration
Bitmask DP subset enumeration lets you iterate all submasks of a given mask using the idiom for (s = mask; s > 0; s = (s - 1) & mask).
DP on Trees
DP on trees is a technique that computes answers for each node by combining results from its children using a post-order DFS.
Edit Distance
Edit distance (Levenshtein distance) measures the minimum number of inserts, deletes, and replaces needed to turn one string into another.
Longest Increasing Subsequence
The Longest Increasing Subsequence (LIS) is the longest sequence you can extract from an array while keeping the original order and making each next element strictly larger.