DataDriven
LearnPracticeInterviewDiscussDailyJobs

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

  1. Read the vague prompt (just like a real interview)
  2. Ask clarifying questions to the AI interviewer
  3. Write your python solution with real code execution
  4. Get instant feedback and a hire/no-hire decision

Related

  • All Mock Interviews
  • Practice Mode (untimed)
  • Python Interview Questions
  • Data Engineering Interview Prep Guide
  • Practice Problems
  • Daily Challenge