Problems > Two Equal Sets > Editorial

Two Equal Sets — Solution & Editorial

Back to the Problem

The total N(N+1)/2 must be even. The greedy from N downward always lands exactly on total/2 because after taking the large numbers the remaining need is < the next number only when small numbers can finish it.

Complexity: O(N)