Dsa
Strings
Warm-up
Character Frequency Map
Create a function that generates a frequency map of characters in a given string. The input will be a single line string. The output should be a list of tuples, each containing a character and its frequency in the original order of first occurrences.
Example input:
banana
Example output:
[(b, 1), (a, 3), (n, 2)]
Key concepts
stringsfrequencymapping
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