Question bank › Strings
Dsa Strings Medium

String Frequency Sort

You need to sort the characters of a string based on frequency, where the most frequent characters appear first. In the case of a tie in frequency, sort characters lexicographically (alphabetically). Return the sorted string. Input: - A single line string containing only lowercase alphabets. Output: - A single string with characters sorted by frequency. Example: Input: aabbcc d Output: aa

Key concepts

stringssortingfrequency

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.