Sherlock and Array

  • + 0 comments
    def balancedSums(arr):
        # Write your code here
        lsum=0
        rsum=sum(arr)
        res='NO'
        for i in range(len(arr)):
            rsum-=arr[i]
            if lsum==rsum:
                res = 'YES'
                break
            lsum+=arr[i]
        return res