A task is to find an index k in array A that will divide it into two arrays (equilibrium index): A[0]+A[1]+A[2]+...+A[k-1] = A[k+1]+A[k+2]+...[A+n] Sum of zero elements is assumed to be equal to 0. The function should return −1 if no equilibrium index exists. Complexity:
class Solution {
0 Comments
Leave a Reply. |
NoticeI have removed Russian content from my website and now will post articles in English only. This is not because of some politics, Russian speaking people you are great, but just it is very hard to support bilingual web site in Weebly. For those who read my articles as usual I ask to click on a single advertisement banner on my web site. This gives me some credits and is free of charge for you. Archives
August 2016
Categories
All
|