MEDIUMasked at 1 company

Strobogrammatic Number II

A medium-tier problem at 53% community acceptance, tagged with Array, String, Recursion. Reported in interviews at Google and 0 others.

Founder's read

Strobogrammatic Number II hits the medium tier but lands on more OAs than its accept rate suggests. You're asked to generate all valid strobogrammatic numbers of a given length, which sounds straightforward until you realize the recursion trap most candidates fall into. Google's asked this one, and it shows up in more assessments than you'd expect once you include filtered company reports. The problem sits at the intersection of string generation and constraint satisfaction. Most candidates either timeout with naive backtracking or mess up the base case logic. If you freeze on the recursion structure during your live assessment, StealthCoder surfaces a working solution in seconds, invisible to the proctor.

Companies asking
1
Difficulty
MEDIUM
Acceptance
53%

Companies that ask "Strobogrammatic Number II"

If this hits your live OA

Strobogrammatic Number II 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. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop.

Get StealthCoder
What this means

The trick here is understanding which digits map to themselves when rotated 180 degrees: 0 to 0, 1 to 1, 8 to 8, 6 to 9, and 9 to 6. The naive approach generates all possible digit combinations and filters invalid ones, which explodes in time complexity. The actual pattern is recursive construction: build from the middle outward or inside inward, adding valid pairs at each step. Most candidates miss that you can't place a 0 in the outermost position and that you need to handle odd-length numbers differently from even ones. The recursion relies on correct base cases and proper pair concatenation. Array building gets messy if you're not careful about order. String manipulation for rotation validation doubles the work unnecessarily. When this problem hits your live OA and the recursive backtracking approach isn't clicking, StealthCoder handles the pattern recognition and code structure instantly.

Pattern tags

The honest play

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

Strobogrammatic Number II 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. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Strobogrammatic Number II interview FAQ

Is Strobogrammatic Number II really medium difficulty or is it harder?+

It's medium by acceptance rate, around 53 percent, but the difficulty feels higher because the recursion isn't obvious. The constraint about leading zeros and valid rotations catches most candidates off guard. Once you nail the inside-out or middle-outward pattern, it becomes straightforward.

What's the difference between a strobogrammatic number and a palindrome?+

Strobogrammatic numbers read the same when rotated 180 degrees; palindromes read the same forwards and backwards. A strobogrammatic number like 609 becomes 609 when flipped. Palindromes don't require rotation mapping. This problem combines rotation logic with sequence generation.

How does recursion actually solve this without timing out?+

Recursion works because you build numbers by adding valid digit pairs at the edges, not by generating all combinations and filtering. Each recursive call adds one pair, so the depth is n/2 for length n. Without recursion, you'd enumerate exponentially many invalid strings and reject them, which times out.

Will Google actually ask me this in a real interview?+

Google is listed as asking this problem. Whether it appears in your specific loop depends on their current pool, but it's in their known question set. Similar recursion-based generation problems show up frequently in their medium-tier assessments.

What do I need to know about Array, String, and Recursion to solve this?+

Array knowledge means building and returning lists efficiently. String knowledge covers padding and concatenation. Recursion is the core: you need to understand base cases, inductive steps, and how to combine results from recursive calls without duplicating work.

Want the actual problem statement? View "Strobogrammatic Number II" 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.