Creating a HashMap containing char as a key and occurrences as a value
Dictionary < int , int > map = new Dictionary < int , int > ( ) ; foreach ( int x in arr ) { if ( map . ContainsKey ( x ) ) map [ x ] = map [ x ] + 1 ; else map . Add ( x , 1 ) ; }