Concepts24
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.
Knapsack Problems
Knapsack problems ask how to pick items under a weight (or cost) limit to maximize value or to check if a target sum is reachable.
Coin Change and Variants
Coin Change uses dynamic programming to find either the minimum number of coins to reach a target or the number of ways to reach it.
Dynamic Programming Fundamentals
Dynamic programming (DP) solves complex problems by breaking them into overlapping subproblems and using their optimal substructure.
DP State Design
Dynamic Programming (DP) state design is the art of choosing what information to remember so that optimal substructure can be reused efficiently.
Floyd-Warshall Algorithm
FloydβWarshall computes the shortest distances between all pairs of vertices in O(n^3) time using dynamic programming.
Topological Sort - DP on DAG
Topological sort orders vertices of a directed acyclic graph (DAG) so every edge goes from earlier to later, which is perfect for dynamic programming (DP).