Problems > Equilibrium Index > Editorial

Equilibrium Index — Solution & Editorial

Back to the Problem

With the total sum known, sweep once maintaining the left sum: position i balances when left = total − left − ai.

Complexity: O(N)