Variable to store the frequency of the least frequent of first K alphabets
int minimum = mp [ ' A ' ] ; for ( int i = 1 ; i < K ; i ++ ) { minimum = min ( minimum , mp [ ( char ) ( i + ' A ' ) ] ) ; } return minimum * K ; }