Problems > Emptying Two Piles > Editorial

Emptying Two Piles — Solution & Editorial

Back to the Problem

Each move removes 3 coins total, so 3 | (A+B); and neither pile may exceed twice the other (the bigger pile loses at most 2 per move). Both conditions together are sufficient.

Complexity: O(T)