Concepts2
⚙️AlgorithmIntermediate
Double Counting
Double counting is the strategy of counting the same quantity in two different ways to derive an equality or an efficient algorithm.
#double counting#contribution technique#handshake lemma+12
⚙️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