You are viewing a single comment's thread. Return to all comments →
int sum = accumulate(arr.begin(), arr.end(), 0); int count = arr[0]; int len = arr.size();
if(sum - count == 0) return "YES"; for(int i = 1; i < len; i++){ if(sum - arr[i] - count == count || sum - arr[i] == 0){ return "YES"; } count += arr[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 →
int sum = accumulate(arr.begin(), arr.end(), 0); int count = arr[0]; int len = arr.size();