An equilibrium index of a sequence is an index into the sequence such that the sum of elements at lower indices is equal to the sum of elements at higher indices. For example, in a sequence A:
[−7, 1, 5, 2, -4, 3, 0]
3 is an equilibrium index, because:
A0 + A1 + A2 = A4 + A5 + A6
6 is also an equilibrium index, because:
A0 + A1 + A2 + A3 + A4 + A5 = 0
(sum of zero elements is zero)
7 is not an equilibrium index, because it is not a valid index of sequence A. Write a function that, given a sequence, returns its equilibrium indices (if any). Assume that the sequence cab be long.