← Questions

Sort characters by frequency

0
AmazonCodingLast asked Sep 2025

Given a string, rearrange it so the most frequent characters come first, each character's copies kept together. Count with a hash map, then sort or bucket by count.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding