Tags: leetcode java python heap
Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string.
Return the sorted string. If there are multiple answers, return any of them
Use hashmap
to count the frequency of all characters in string
Insert character & frequency pair into Max Heap
where frequency is used for ranking.
Extract Maximum from the heap and append it to the output string.