JavaScript Program to find sum between two indexes when there is no update .
let pre = new Array ( 1000 , 0 ) ; function preCompute ( arr , n ) { pre [ 0 ] = arr [ 0 ] ; for ( let i = 1 ; i < n ; i ++ ) pre [ i ] = arr [ i ] + pre [ i - 1 ] ; }