Function to compute prefix - sum of the input array
def prefix_sum ( arr , n ) : NEW_LINE INDENT pre_sum = list ( ) NEW_LINE pre_sum . append ( arr [ 0 ] ) NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT pre_sum . append ( pre_sum [ i - 1 ] + arr [ i ] ) NEW_LINE DEDENT return pre_sum NEW_LINE DEDENT