Stores the frequencies of array elements
Dictionary < int , int > mapA = new Dictionary < int , int > ( ) ; Dictionary < int , int > mapB = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mapA . ContainsKey ( A [ i ] ) ) { mapA [ A [ i ] ] = mapA [ A [ i ] ] + 1 ; } else { mapA . Add ( A [ i ] , 1 ) ; } if ( mapB . ContainsKey ( B [ i ] ) ) { mapB [ B [ i ] ] = mapB [ B [ i ] ] + 1 ; } else { mapB . Add ( B [ i ] , 1 ) ; } }