You are viewing a single comment's thread. Return to all comments →
from functools import reduce def balancedSums(arr): sum_arr = sum(arr) return 'YES' if (reduce(lambda a, b: a + (b if a <= sum_arr // 2 else 0), arr) == reduce(lambda a, b: a + (b if a <= sum_arr // 2 else 0), reversed(arr))) else '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 →