Return the maximum difference between frequencies of any two elements such that element with greater frequency is also greater in value .
static int maxdiff ( int [ ] arr , int n ) { Dictionary < int , int > freq = new Dictionary < int , int > ( ) ;