You are viewing a single comment's thread. Return to all comments →
C++
string balancedSums(vector<int> arr) { int sums = accumulate(arr.begin(),arr.end(),0); int leftSums = 0; for(int i : arr){ if(sums-i == leftSums) return "YES"; else{ sums -= i; leftSums += i; } } return "NO"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Array
You are viewing a single comment's thread. Return to all comments →
C++