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