Computing the prefix sum for all the elements in the array
prefix = [ 0 for i in range ( n + 1 ) ] NEW_LINE prefix [ 0 ] = arr [ 0 ] NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT prefix [ i ] = prefix [ i - 1 ] + arr [ i ] NEW_LINE DEDENT