Codility Equi Test Solution

Codility

A zero-indexed array A consisting of N integers is given. An equilibrium index of this array is any integer P such that 0 ≤ P < N and the sum of elements of lower indices is equal to the sum of elements of higher indices, i.e. A[0] + A[1] + … + A[P−1] = A[P+1] + … + A[N−2] + A[N−1]. Sum of zero elements is assumed to be equal to 0. [Read More]