Calculate suffix sum in each row
for i in range ( N ) : NEW_LINE INDENT for j in range ( M - 2 , - 1 , - 1 ) : NEW_LINE INDENT b [ i ] [ j ] = arr [ i ] [ j ] + b [ i ] [ j + 1 ] ; NEW_LINE DEDENT DEDENT