cur_sum to keep track of cummulative sum till that polet
let cur_sum = 0 ; let start = 0 ; let end = - 1 ; let hashMap = new Map ( ) ; for ( let i = 0 ; i < n ; i ++ ) { cur_sum = cur_sum + arr [ i ] ;