1 people like it.
Like the snippet!
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. The following is an implementation of such equilibrium list (given the input is a list).
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: |
|
Link: | http://fssnip.net/f2 |
Posted: | 12 years ago |
Author: | Joel Huang |
Tags: | equilibrium index , list |