Raise Everyone Up — Solution & Editorial
Only raising is allowed, so the target is the current maximum: N·max − sum.
Complexity: O(N)
Watch out: N·max needs 64 bits.
Only raising is allowed, so the target is the current maximum: N·max − sum.
Complexity: O(N)
Watch out: N·max needs 64 bits.