Concepts146

⚙️AlgorithmIntermediate

LIS Variants

LIS variants extend the classic longest increasing subsequence to handle non-decreasing sequences, counting how many LIS exist, and maximizing the sum of a subsequence.

#lis#lnds#patience sorting+12
⚙️AlgorithmIntermediate

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.

#tree dp#maximum matching#vertex cover+12
⚙️AlgorithmIntermediate

Bitmask DP

Bitmask DP compresses the state of a subset of n elements into an integer mask, enabling elegant dynamic programming over all subsets.

#bitmask dp#subset dp#held-karp+12
⚙️AlgorithmIntermediate

Longest Common Subsequence

The Longest Common Subsequence (LCS) between two sequences is the longest sequence that appears in both, not necessarily contiguously.

#longest common subsequence#lcs#string dp+12
⚙️AlgorithmIntermediate

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).

#bitmask#submask enumeration#superset enumeration+11
⚙️AlgorithmIntermediate

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.

#tree dp#post-order dfs#rerooting+12
⚙️AlgorithmIntermediate

Edit Distance

Edit distance (Levenshtein distance) measures the minimum number of inserts, deletes, and replaces needed to turn one string into another.

#edit distance#levenshtein#dynamic programming+11
⚙️AlgorithmIntermediate

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.

#longest increasing subsequence#lis#dynamic programming+12
⚙️AlgorithmIntermediate

2-SAT

2-SAT solves Boolean formulas where every clause has exactly two literals, and it is solvable in linear time relative to the size of the implication graph.

#2-sat#implication graph#strongly connected components+12
⚙️AlgorithmIntermediate

Euler Path and Circuit

An Euler path visits every edge exactly once, and an Euler circuit is an Euler path that starts and ends at the same vertex.

#euler path#euler circuit#hierholzer algorithm+12
⚙️AlgorithmIntermediate

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.

#0/1 knapsack#unbounded knapsack#bounded knapsack+12
⚙️AlgorithmIntermediate

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.

#coin change#dynamic programming#unbounded knapsack+12