• + 0 comments

    This python code worked.

    def hourglassSum(arr):
        # Write your code here
        addn=[] 
        for i in range(4): 
            for j in range(4): 
                top=arr[i][j]+arr[i][j+1]+arr[i][j+2] 
                middle=arr[i+1][j+1] 
                bottom=arr[i+2][j]+arr[i+2][j+1]+arr[i+2][j+2] 
                add=top+bottom+middle 
                addn.append(add)
        return max(addn)