text: Stores frequency of each element present in sumArr map < int , int > freqCount ;
code: HashMap < Integer , Integer > freqCount = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! freqCount . containsKey ( C [ i ] ) ) freqCount . put ( C [ i ] , 1 ) ; else freqCount . put ( C [ i ] , freqCount . get ( C [ i ] ) + 1 ) ; }