The Letter Ledger
A easy Python mock interview question on DataDriven. Practice with AI-powered feedback, real code execution, and a hire/no-hire decision.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L4
Interview Prompt
Implement a `CharFrequency` class. Its constructor takes a string `text` and builds a frequency map of its characters, ignoring spaces. Its `get_counts()` method returns a list of `[char, count]` pairs (each a two-element list) for the distinct characters, sorted alphabetically by character. The test harness calls the provided `char_frequency(text)` driver, which constructs `CharFrequency(text)` and returns its `get_counts()`. For `"hello world"` it returns `[["d", 1], ["e", 1], ["h", 1], ["l", 3], ["o", 2], ["r", 1], ["w", 1]]`. An empty (or all-spaces) string yields an empty list.
Summary
Every character has a count to answer for.
How This Interview Works
- Read the vague prompt (just like a real interview)
- Ask clarifying questions to the AI interviewer
- Write your python solution with real code execution
- Get instant feedback and a hire/no-hire decision