Dsa
Strings
Warm-up
Character Frequency
Given a string, return a dictionary where the keys are the unique characters in the string and the values are the counts of those characters.
Example:
Input:
banana
Output:
{'b': 1, 'a': 3, 'n': 2}
Key concepts
stringsfrequencycounting
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