You are viewing a single comment's thread. Return to all comments →
There is no need to have a separate check for singleton lists.
def balanced_sums(arr): total = sum(arr) so_far = 0 for i in arr: if total - i == 2*so_far: return 'YES' else: so_far += 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 →
There is no need to have a separate check for singleton lists.