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 25%
Lv0Sys
madeforlosers
Natanaelel
helbling
#2
75 c.
Top 38%
adh98
voytxt
#3
76 c.
Top 44%
XenThe
#4
80 c.
Top 50%
500error
#5
82 c.
Top 56%
CorentinTh
#6
87 c.
Top 63%
maximec-indy
#7
88 c.
Top 69%
Thomasdcrt
#8
95 c.
Top 75%
SephQ
#9
148 c.
Top 81%
ComputerKWasTaken
#10
174 c.
Top 88%
emma
#11
212 c.
Top 94%
Mif712
#12
1240 c.
Top 100%
Alex