You are viewing a single comment's thread. Return to all comments →
Java:
public static String balancedSums(List<Integer> arr) { int sum = 0; for (int i : arr) { sum += i; } int left = 0; for (int i = 0; i < arr.size(); i++) { int right = sum - left - arr.get(i); if (right == left) { return "YES"; } left += arr.get(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 →
Java: