451. Sort Characters By Frequency 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. 123456789101112131415class Solution {public: string frequencySort(string s) { string res = ""; unordered_map<char, int> mp; priority_queue<pair<int,char>> pq; for(auto& ch : s) mp[ch]++; for(auto& [k, v] : mp) pq.push({v, k}); while(!pq.empty()) { auto [c, ch] = pq.top(); pq.pop(); res += string(c, ch); } return res; }};