Equilibrium Index — Solution & Editorial
With the total sum known, sweep once maintaining the left sum: position i balances when left = total − left − ai.
Complexity: O(N)
With the total sum known, sweep once maintaining the left sum: position i balances when left = total − left − ai.
Complexity: O(N)