can you please tell me which case is not passed , as all other cases is passed except 1
Case 1 is not passed
in question it is mentioned that we have to get the maximum occuring char of a String then why we have to sort
Sample input: abc
your output: a
Correct output: c
Better approach:
1.Declare an Array of 26 size to store the Freq of each character.
2.Each time any character is encountered increment its corresponding freq at that index.
3.Declare a max variable and put a loop on filled array.
4.Update the max and character accordingly.
refer to this