Prefix Array to Maintain Sum of log values till index i
let prefixsum = new Array ( N ) ; prefixsum [ 0 ] = Arraynew [ 0 ] ; for ( let i = 1 ; i < N ; i ++ ) { prefixsum [ i ] = prefixsum [ i - 1 ] + Arraynew [ i ] ; }