Sherlock and Array

  • + 0 comments
    def balancedSums(arr):
        # Write your code here
        total_sum = sum(arr)
        right_acc = 0
        for index in range(len(arr)):
            total_sum -= arr[index]
            if (right_acc == total_sum):
                return "YES"
            right_acc += arr[index]
        return "NO"