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