You are viewing a single comment's thread. Return to all comments →
Python
def balancedSums(arr): l = 0 r = len(arr) - 1 sum_left = arr[l] sum_right = arr[r] while l < r: if sum_left < sum_right: l += 1 sum_left += arr[l] else: r -= 1 sum_right += arr[r] if sum_left == sum_right: 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 →
Python