10911 - Forming Quiz Teams
For every $dp[i] = k$, we define $i$ as the collection of people that’re not paired yet, and $k$ is the minimum cost to pair those people up, if possible.
Starting with (1 << n) - 1
, we can pair 2 of them at a time, and recurse on (state ^ (1 << i) ^ (1 << j))
.
Notice the base case is $dp[0] = 0$.