Skip to main content

Practice · 3 of 5

Most frequent character (with a tie-break)

CHALLENGE
Difficulty: advanced+25 XP

Return the **most frequent character** in the string; on a tie, return the alphabetically **smallest** of the tied characters. The string is non-empty and lowercase. Examples: "aabbbc" → 'b'; "abab" → 'a' (a and b tie, a wins).

Back to lesson: Practice: Method mastery gauntlet