Approach hintTry it first, then revealHide
The operation never changes how many numbers have each bit set; it only moves bits between numbers. Count bits per position and greedily build each new number from every bit that still has supply.
The operation never changes how many numbers have each bit set; it only moves bits between numbers. Count bits per position and greedily build each new number from every bit that still has supply.