Function to compute prefix - sum of the input array
vector < int > prefix_sum ( vector < int > arr , int n ) { vector < int > pre_sum ; pre_sum . push_back ( arr [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) pre_sum . push_back ( pre_sum [ i - 1 ] + arr [ i ] ) ; return pre_sum ; }