cur_sum to keep track of cummulative sum till that point
int cur_sum = 0 ; int start = 0 ; int end = - 1 ; Dictionary < int , int > hashMap = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { cur_sum = cur_sum + arr [ i ] ;