Traverse through the lower triangular matrix
for i in range ( 1 , n ) : NEW_LINE INDENT x , y , sum = i , 0 , 0 NEW_LINE for j in range ( i , n ) : NEW_LINE INDENT sum , x , y = sum + arr [ x ] [ y ] , x + 1 , y + 1 NEW_LINE DEDENT if ( sum > ans ) : NEW_LINE INDENT ans = sum NEW_LINE DEDENT DEDENT return ans NEW_LINE