0451. Sort Characters By Frequency
https://leetcode.com/problems/sort-characters-by-frequency
Description
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.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= s.length <= 5 * 105
s
consists of uppercase and lowercase English letters and digits.
ac
Last updated