Function to return the prefix_sum vector
function getPrefixSum ( arr ) { let n = arr . length ; let new_arr = new Array ( n ) ; for ( let i = 0 ; i < n ; i ++ ) new_arr [ i ] = arr [ i ] ; for ( let i = 1 ; i < n ; i ++ ) new_arr [ i ] = new_arr [ i - 1 ] + new_arr [ i ] ; return new_arr ; }