Concepts2
⚙️AlgorithmIntermediate
Contribution Technique
The contribution technique flips perspective: compute how much each element contributes to the total, then sum these contributions.
#contribution technique#monotonic stack#sum of subarray minimums+12
⚙️AlgorithmAdvanced
Virtual Tree (Auxiliary Tree)
A Virtual Tree (Auxiliary Tree) compresses a large tree into a much smaller tree that contains only the k important nodes and the LCAs needed to keep them connected.
#virtual tree#auxiliary tree#lca+12