Character Frequency Sort

Sort a string by the frequency of each character.

Easy5/15/2024

Problem statement

Given a lowercase string, return a new string sorted by the frequency of each character in descending order, followed by the characters in alphabetical order if frequencies are the same.

Example: For mississippi the output should be iiiissssppm

Problem leaderboard

#
Size
%
Users
#1
73 c.
Top 27%
Natanaelel
madeforlosers
helbling
Lv0Sys
#2
75 c.
Top 40%
adh98
voytxt
#3
80 c.
Top 47%
500error
#4
82 c.
Top 53%
CorentinTh
#5
87 c.
Top 60%
maximec-indy
#6
88 c.
Top 67%
Thomasdcrt
#7
95 c.
Top 73%
SephQ
#8
148 c.
Top 80%
ComputerKWasTaken
#9
174 c.
Top 87%
emma
#10
212 c.
Top 93%
Mif712
#11
1240 c.
Top 100%
Alex