Concepts3
⚙️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
⚙️AlgorithmAdvanced
DP with Expected Value
Dynamic programming with expected value solves problems where each state transitions randomly and we seek the expected cost, time, or steps to reach a goal.
#expected value dp#linearity of expectation#indicator variables+11