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