Stores the frequency of prefix sums in the array
var mp = new Map ( ) ; mp . set ( arr [ 0 ] , 0 ) ; for ( var i = 1 ; i < n ; i ++ ) { arr [ i ] = arr [ i ] + arr [ i - 1 ] ; mp . set ( arr [ i ] , i ) ; }