text: Stores the frequency of array elements
code: int [ ] freq = new int [ n + 1 ] ; for ( int i = 0 ; i < n ; ++ i ) { freq [ a [ i ] ] ++ ; } int maxFreqElement = int . MinValue ; int maxFreqCount = 1 ; for ( int i = 1 ; i <= n ; ++ i ) {