Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Leetcode 451. Sort Characters By Frequency
Reorder the characters of a string so that characters appear in descending order of their frequency, returning any valid ordering where identical characters are grouped together. Characters are case-sensitive (letters and digits allowed) and the string length can be up to 5e5.
Asked at:
Amazon
Microsoft
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early October, 2025
Microsoft
Mid-level
Didn't want the Map and PriorityQueue Approach. INPUT: tree O/P: e : 2 t : 1 r : 1
Mid November, 2024
Amazon
Junior
Sort String by Frequency: Sort characters in a string in decreasing order of their frequency. If multiple answers exist, return any valid one.
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.