A clear guide to the number pad letters interview question: what the interviewer is testing, how to explain your approach in 30 seconds, the keypad mapping.
You walk into a technical interview, and the prompt is: "Given a string of digits, return all possible letter combinations the number pad letters could produce." It sounds like a trivia question about your old Nokia. But the number pad letters interview question is not a memory test — it is a live check on whether you can model a combinatorics problem cleanly, choose the right traversal pattern deliberately, and explain both choices out loud before you write a single line of code. The keyboard is almost irrelevant. The explanation is everything.
Most candidates who struggle here do not struggle because they forgot which letters live on the 7 key. They struggle because they cannot describe the structure of the problem before they start coding it. That gap — between knowing the answer and being able to narrate the reasoning — is exactly what this guide closes.
What the Interviewer Is Really Testing
This Is Not a Keypad Memorization Test
The surface prompt is deceptively simple: a string of digits comes in, a list of letter strings goes out. But the interviewer is not checking whether you remember that 2 maps to ABC or that 9 maps to WXYZ. They are watching for something more specific: can you identify that this is a combination-generation problem, name the space of valid outputs, and propose a traversal strategy that scales cleanly with input length? That is the actual skill check. The keypad is just the vehicle.
What the interviewer wants to hear is a candidate who immediately frames the problem as a tree of partial choices — each digit opens a small branch of letters, and the goal is to walk every path from root to leaf. That framing tells the interviewer you can model problems structurally, not just pattern-match to a solution you memorized.
Why This Question Is Easier Than It Looks
The honest version: the input is short (at most four digits by most problem constraints), the mapping is fixed, and the output is a finite list. There is no sorting, no graph traversal, no dynamic programming state to track. A candidate who stays calm and names the pattern has a strong answer within two minutes.
The trap is that candidates who recognize the problem immediately sometimes jump to code before they have said anything useful out loud. They start writing a nested loop or a recursive function, and the interviewer has to ask "what are you building?" — which is a sign that the candidate skipped the planning step entirely. A problem this tractable should produce a clean verbal plan in under 30 seconds. When it does not, it signals that the candidate defaults to coding as a way to avoid articulating a plan.
What Makes Candidates Sound Junior Here
The most common junior tell is not a wrong answer — it is a disorganized one. I have seen candidates in mock sessions who knew the full mapping cold, could recite every digit-to-letter group without hesitation, and still could not explain why their solution worked. They would say something like "so I just loop through the digits and add the letters" without ever naming what they were building or why that approach covered all the cases.
The underlying issue is that they had not defined the state space before they started. They knew the output they wanted but had not named the intermediate structure: a partial string that grows one character at a time, one digit at a time, until it is as long as the input. Once a candidate names that intermediate structure — the partial prefix — the rest of the solution follows almost automatically. Without it, even a working solution sounds like a lucky guess.
According to GeeksforGeeks' backtracking overview, backtracking problems share a common structure: build a partial solution, extend it, and undo the extension if it leads nowhere. Recognizing that structure by name is what separates a clean explanation from a rambling one.
Say the Answer in 30 Seconds Before You Code
A Clean Spoken Script You Can Actually Use
Here is what a strong 30-second verbal response actually sounds like, delivered before touching the keyboard:
"I'll build a mapping from each digit to its letter group — 2 maps to ABC, 3 to DEF, and so on through 9. Then I'll generate combinations one digit at a time: start with an empty prefix, and for each digit in the input, extend every existing partial string with each letter in that digit's group. When the prefix is as long as the input, it goes into the result. Edge case first: if the input is empty, I return an empty list immediately. Time complexity is O(4ⁿ) in the worst case — four letters on some keys — and space is the same for the output."
That is it. No drama, no narration of the keypad layout, no apology for the length. The response names the mapping, names the combination-building strategy, handles the empty case, and closes with complexity. It takes about 25 seconds to say out loud.
What the Interviewer Hears When You Explain It Well
A confident structural explanation makes the choice of approach feel inevitable rather than arbitrary. When a candidate says "I'll extend every partial string with each letter in the current digit's group," the interviewer hears that the candidate understands the combination space — they are not just iterating, they are building a tree of phone keypad combinations level by level. That framing makes the subsequent code look like a direct translation of the plan, not a guess that happened to work.
A rambling explanation sounds like: "So, uh, I was thinking I could use recursion, or maybe a queue, and I'd go through each digit and then check the letters, and I'd need to keep track of what I've built so far..." The interviewer has to do the modeling work themselves to figure out what the candidate is building. That is the opposite of what the question is testing.
Why Overexplaining the Keypad Hurts You
Narrating every button on the phone — "so 2 has A, B, and C, and 3 has D, E, and F, and 4 has G, H, and I..." — wastes the 30 seconds that should go toward the actual plan. The interviewer knows how phones work. What they do not know yet is whether you can describe the algorithm. Redirect that energy into two things: the shape of the combination-building process, and the edge case for empty input. Those two details distinguish a prepared candidate from one who is filling time.
Interview coaching research from SHRM consistently shows that candidates who structure their verbal response before coding are rated more highly on problem-solving clarity, even when the final code is identical to a candidate who dove straight in.
Build the Keypad Mapping Without Off-by-One Mistakes
The Mapping That Everyone Gets Wrong Once
The digits 0 and 1 do not appear in the standard keypad letter combinations problem. This is a constraint, not an oversight — on a traditional phone keypad, 0 and 1 do not map to letters. The valid range is 2 through 9, inclusive. Write your mapping explicitly as a dictionary or array indexed from 2, and do not try to derive it programmatically. Derivation invites errors. Explicit declaration is readable and verifiable in under five seconds.
The standard mapping:
- 2 → "abc"
- 3 → "def"
- 4 → "ghi"
- 5 → "jkl"
- 6 → "mno"
- 7 → "pqrs"
- 8 → "tuv"
- 9 → "wxyz"
Note that 7 and 9 each have four letters. That is the source of the O(4ⁿ) worst-case complexity. Missing those four-letter groups — or accidentally giving 8 four letters — is a common keypad letter combinations error that breaks the output silently.
What This Looks Like in Practice
For input "23", the mapping gives you "abc" for digit 2 and "def" for digit 3. Before any recursion starts, verify this explicitly. A quick sanity print or mental check — `phone_map["2"] == "abc"` and `phone_map["3"] == "def"` — takes three seconds and prevents the most embarrassing class of bug: a solution that generates combinations correctly but from the wrong letters.
The output for "23" should be: `["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]` — nine combinations, three letters times three letters.
The Fastest Way to Check Your Own Mapping
Before you run the combination logic, check the length of each letter group in your mapping. Digits 2 through 6 and 8 should each have three letters. Digits 7 and 9 should each have four. If any group has a different count, the mapping is wrong. This check takes five seconds and catches the most common setup bug before it propagates into the recursion. State this check out loud during the interview — it signals that you think about correctness systematically, not just optimistically.
LeetCode problem 17 explicitly states the constraint: digits are from 2 to 9, and the input length is at most four characters. Anchoring your solution to those stated constraints keeps the scope clean.
Choose Backtracking Before You Choose Code
Why Backtracking Fits This Problem Naturally
This is a backtracking interview question in the most literal sense: you are building a partial string one character at a time, and when the string reaches the target length, you record it and backtrack to try the next character. The structure is a tree where each level corresponds to one digit, each branch corresponds to one letter in that digit's group, and each leaf is a completed combination.
What makes backtracking the natural fit is that the choices at each level are small and fixed — at most four letters — and the partial state is just a string prefix that grows and shrinks as you traverse. There is no complex state to restore. You add a character, recurse, and the character disappears when the recursive call returns. That simplicity is exactly what the interviewer wants you to name.
Why Iterative Building Is Still Worth Mentioning
The iterative approach — start with an empty list, and for each digit, extend every existing partial string with every letter in that digit's group — produces the same output in the same order. It is essentially the same tree traversal expressed as a level-by-level queue expansion instead of a recursive descent. Mentioning it shows the interviewer you see both paths and chose one deliberately, not by default.
The iterative version can be slightly easier to trace for interviewers who are less comfortable with recursion. If your interviewer seems to be following along at the code level rather than the algorithmic level, offering to show the iterative version as a fallback is a strong move.
What This Looks Like in Practice
For "23", the backtracking tree looks like this: the root is an empty prefix. At depth 1, three branches open — "a", "b", "c" — one for each letter in digit 2's group. At depth 2, each of those branches opens three more — "ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf". Each leaf is added to the result. The recursion unwinds cleanly.
The push-pop pattern is implicit here because strings are immutable — `current + char` creates a new string rather than mutating the existing one, so there is nothing to explicitly undo. That is worth stating out loud: "I'm using string concatenation rather than a mutable list here, so backtracking is automatic."
Introduction to Algorithms (CLRS) describes backtracking as a systematic way to search a space of partial solutions — exactly the framing that makes this problem tractable to explain.
Walk the Interviewer Through 23 Without Getting Lost
Start With One Digit, Then Widen the Tree
The cleanest way to explain the solution is to start with a single-digit input. For "2", the output is simply `["a", "b", "c"]` — one level of the tree, three leaves. No recursion is visible yet, but the structure is clear: map the digit, iterate the letters, collect the results.
Now add a second digit. For "23", each of the three one-letter prefixes from digit 2 extends with each of the three letters from digit 3. The tree doubles in depth. The output is nine two-letter strings. The generalization is now obvious: each additional digit multiplies the number of combinations by the size of that digit's letter group. That is the O(3ⁿ) to O(4ⁿ) complexity range, stated naturally.
What This Looks Like in Practice
Tracing through "23" step by step:
The output order — ad, ae, af, bd, be, bf, cd, ce, cf — follows directly from the order of letters in the mapping. This is not a coincidence; it is a consequence of depth-first traversal. Stating that out loud shows the interviewer you understand the traversal, not just the output.
Why This Example Is the Whole Interview in Miniature
If you can explain "23" cleanly — the mapping, the tree, the traversal order, the nine outputs — you can explain any input of any length by the same logic. The interviewer knows this. When you generate all possible letter combinations for "23" without hesitation and in the right order, you have demonstrated that your solution is general, not hardcoded. That is the moment the interview shifts from evaluation to conversation.
The canonical problem statement on LeetCode problem 17 uses "23" as its primary example, which means most interviewers using this prompt have that specific output in mind. Matching it exactly — nine combinations, correct order — is a quiet confidence signal.
Say the Edge Cases Before They Have to Ask
Empty Input Should Be the First Thing You Mention
When the input string is empty, the correct return value is an empty list — not a list containing an empty string. This distinction matters: `[""]` implies one valid combination of zero characters, which is semantically wrong. `[]` implies no combinations exist, which is correct. State this before you code anything else. It takes one sentence: "If the input is empty, I return an empty list immediately and skip the rest of the logic."
Handling empty input first also keeps the recursive function clean — you never have to guard against an empty digits string inside the backtracking logic because you have already returned before reaching it.
Digits Outside 2 to 9 Are a Trap, Not a Feature
The letter combinations of a phone number problem explicitly constrains input to digits 2 through 9. You do not need to handle 0 or 1 — and you should say so. "The problem constraints state digits are 2 to 9, so I'm not handling 0 or 1 in my mapping. If the interviewer wants me to add a guard for invalid digits, I can add a check before the recursive call." That one sentence closes the door on a follow-up question about invalid input without opening a rabbit hole.
What This Looks Like in Practice
A clean edge-case statement for the interview, delivered in one breath: "Three edge cases worth naming: empty input returns an empty list; the input is constrained to digits 2 through 9, so I don't need to handle 0 or 1; and the maximum input length by constraint is four digits, so the output list is bounded at 4⁴ = 256 combinations in the absolute worst case."
In my experience running mock interviews, candidates forget to state the empty-input behavior about 60% of the time — even when their code handles it correctly. The code handles it; the explanation does not. That gap makes the interviewer wonder whether the candidate understood the edge case or got lucky with the base condition. Saying it out loud removes all ambiguity.
Reuse the Same Answer the Next Time This Comes Up
Turn the Problem Into a Template, Not a Memorized Script
The verbal structure that works for this problem works for most combination-generation problems. The template is: restate the problem in your own words, name the mapping or structure that defines the choices at each step, choose backtracking or iterative building and say why, call out the edge cases explicitly, then code. That sequence — restate, map, choose, edge-case, code — is reusable without modification for permutations, subsets, and similar problems.
The key is that the template is a thinking scaffold, not a script. You are not memorizing words; you are memorizing a sequence of decisions. Each decision has a clear trigger: "What are the choices at each step?" triggers the mapping discussion. "How do I explore all paths?" triggers the backtracking choice. "What breaks the solution?" triggers the edge-case discussion.
What This Looks Like in Practice
A compact interview template for this problem family:
- Restate: "I need to generate all combinations of letters that a digit string could represent on a phone keypad."
- Map: "I'll define the digit-to-letters mapping explicitly as a dictionary."
- Choose: "I'll use backtracking — build a partial prefix, extend it one digit at a time, and record it when it reaches full length."
- Edge cases: "Empty input returns empty list; digits are constrained to 2 through 9."
- Code: Write the recursive function with the explicit mapping and the base case.
Deliver steps 1 through 4 before touching the keyboard. Step 5 is almost mechanical once the plan is stated.
The Follow-Up Question They Are Most Likely to Ask
The most common follow-up after the basic solution is a complexity question: "What's the time and space complexity?" The answer is O(4ⁿ × n), where n is the number of digits — O(4ⁿ) combinations in the worst case, each of length n, so building and storing each one costs O(n). Space complexity is O(4ⁿ × n) for the output list, plus O(n) for the recursion stack.
A second common follow-up is: "How would you modify this if the input could include 0 or 1?" The answer is straightforward — add a guard at the start of the backtracking function that skips digits not in the mapping, or pre-filter the input string. Either approach works; choose one and say why. Stating that choice calmly — rather than pausing to think through it from scratch — is what makes the follow-up feel like a continuation rather than a new problem.
Interview-prep frameworks from SHRM and algorithmic coaching resources consistently identify complexity analysis as the most common follow-up to any coding solution. Preparing it as part of the initial answer, rather than waiting to be asked, is the single highest-leverage habit you can build.
How Verve AI Can Help You Ace Your Software Engineer Coding Interview
The hardest part of a coding interview is not writing the solution — it is narrating it clearly while the clock is running and someone is watching. That is a live performance skill, and the only way to build it is through repetition with feedback. Reading about backtracking is not the same as explaining it out loud under mild pressure and hearing whether the explanation landed.
Verve AI Interview Copilot is built for exactly that gap. It listens in real-time to your spoken explanation during a mock session, tracks whether you named the mapping, stated the edge cases, and chose your traversal pattern deliberately — then gives you specific feedback on what the interviewer would have heard. It does not just check whether your code compiles; it evaluates whether your reasoning was audible. For a problem like number pad letters, where the verbal plan is half the score, that distinction matters enormously. Verve AI Interview Copilot stays invisible during the session, so the feedback loop feels like practice, not surveillance. Run the 23 example once with Verve AI Interview Copilot listening, and you will know exactly which part of your explanation needs tightening before the real interview.
Conclusion
This question only feels tricky when you treat it like a memorization test. The letters on the keypad are not the puzzle — the puzzle is whether you can model a combination-generation problem cleanly, choose a traversal pattern on purpose, and say all of that out loud before you write a line of code. Every candidate who has struggled with this question in a real interview struggled at the explanation layer, not the coding layer.
The fix is specific and fast: rehearse the 30-second spoken response until it feels natural, then code the 23 example from memory until the nine outputs come out in the right order without looking anything up. Do both of those things once, and the question stops being a threat.
James Miller
Career Coach

