MEDIUMasked at 1 company

Count Number of Texts

A medium-tier problem at 49% community acceptance, tagged with Hash Table, Math, String. Reported in interviews at Goldman Sachs and 0 others.

Founder's read

You get a string of digits and need to count how many distinct text messages could be formed using a phone keypad mapping (like a T9 keyboard). This problem filters through roughly half of all submissions cleanly, which means half the people solving it miss the pattern or implement it inefficiently. Goldman Sachs has asked it. The trick isn't just brute force enumeration. You need to recognize that each digit group compounds independently, and the combinatorics stack up fast. If you blank on the math during the live OA, StealthCoder reads the problem and surfaces the working solution in seconds while you stay invisible to the proctor.

Companies asking
1
Difficulty
MEDIUM
Acceptance
49%

Companies that ask "Count Number of Texts"

If this hits your live OA

Count Number of Texts is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.

Get StealthCoder
What this means

The core insight is that each digit maps to multiple characters (like '2' maps to 'a', 'b', 'c'), and you're counting the total combinations possible when you concatenate those groups. This is a multiplication principle problem disguised as dynamic programming. Many candidates start building a DP table or recursion tree when the real work is just computing the product of group sizes. The pitfall: overthinking it as a path-counting problem when it's actually a character-mapping multiplication. Hash tables store the digit-to-character mappings, String handling parses the input, Math does the multiplication, and DP emerges if you optimize for overlapping subproblems or memoization (though the greedy product often solves it). StealthCoder is the safety net if you realize mid-assessment that your recursive approach is timing out.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Count Number of Texts recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Count Number of Texts interview FAQ

Is this actually a DP problem or just math?+

Both. The pure math solution (multiply the group sizes) works for the standard version. DP matters if constraints are extended or if you want to optimize repeated calls. Most submissions that clear efficiently skip DP and use the direct calculation, but understanding DP confirms the structure.

How hard is Count Number of Texts compared to other medium problems?+

Acceptance rate is roughly 49%, so it sits around the median difficulty for medium. The problem is easy to state but easy to overthink. Most failures come from missed pattern recognition, not from implementation complexity.

Do I need to know T9 keypads to solve this?+

No. The keypad mapping is given or standard (2='abc', 3='def', etc.). Memorizing the mapping isn't the challenge. The challenge is recognizing that each digit is independent and their counts multiply.

Will Goldman Sachs ask this exact problem or a variant?+

They've asked it. Variants might include counting sequences with constraints, or mapping different characters per digit. The underlying principle stays the same: recognize independence and apply multiplication.

What's the most common mistake in live OAs?+

Building unnecessary DP or recursion when a single pass multiplying group sizes answers the question. Candidates overthink and run out of time. If you hit that wall during assessment, StealthCoder unblocks it instantly.

Want the actual problem statement? View "Count Number of Texts" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.