Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ex.
- A[0] = -1
- A[1] = 3
- A[2] = -4
- A[3] = 5
- A[4] = 1
- A[5] = -6
- A[6] = 2
- A[7] = 1
- P = 1 is an equilibrium index of this array, because:
- A[0] = −1 = A[2] + A[3] + A[4] + A[5] + A[6] + A[7]
- P = 3 is an equilibrium index of this array, because:
- A[0] + A[1] + A[2] = −2 = A[4] + A[5] + A[6] + A[7]
- P = 7 is also an equilibrium index, because:
- A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement