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