Reconstruct Digits from Jumbled English Words
Reported by candidates from Microsoft's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Microsoft reported this one in September 2026, and it looks like a string problem but it's really a letter-counting puzzle. You get a shuffled pile of letters and have to figure out which digit words made it. If you've got an OA invite, know this: the trick is a fixed order of elimination, not search. There's a twist on the classic version too. You must return INVALID when the letters don't split cleanly into digit words. StealthCoder is there as a safety net if you blank mid-assessment, but the approach below is short enough to memorize tonight.
The problem
A lowercase string is formed by concatenating zero or more English digit words (zero through nine) and arbitrarily shuffling all letters. Return the original digits in ascending order. Repeated digit words are allowed. Return INVALID when the letters cannot be partitioned completely into digit words. Function reconstructEnglishDigits(letters: String) → String Examples Example 1 letters = "owoztneoer" return = "012" The letters form zero, one, and two. Example 2 letters = "fviefuro" return = "45" The letters form four and five. Example 3 letters = "abc" return = "INVALID" The letters cannot be consumed by digit words. Constraints 0 <= letters.length <= 100000. letters contains lowercase English letters.
Reported by candidates. Source: FastPrep
Pattern and pitfall
It reduces to counting. Build a frequency array of 26 letters. Some letters appear in exactly one digit word: z only in zero, w in two, u in four, x in six, g in eight. Count those first, then subtract their other letters. After that, o is unique to one (zero, two, four already removed), h to three (eight removed), f to five (four removed), s to seven (six removed), and i to nine (five, six, eight removed). Subtract each word's letters from the counts as you go. The pitfall is the INVALID case. The classic version assumes valid input, this one doesn't. After peeling off all ten digits, check every letter count is exactly zero. Also watch for negative counts mid-way, which means invalid. Empty input returns an empty string. Output digits sorted ascending by building a count per digit. That's O(n) time. StealthCoder is your hedge in the live OA if the elimination order slips your mind.
Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.
You can drill Reconstruct Digits from Jumbled English Words cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as reconstruct original digits from english. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Microsoft's OA.
Microsoft reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Reconstruct Digits from Jumbled English Words FAQ
What's the trick to Reconstruct Digits from Jumbled English Words?+
Identify letters unique to one digit word and peel them off in a safe order. Use z for zero, w for two, u for four, x for six, g for eight. Then o for one, h for three, f for five, s for seven, i for nine. Subtract each word's letters after counting.
How do I detect INVALID in this Microsoft OA problem?+
After extracting all ten digit counts and subtracting their letters, every letter count must be exactly zero. If any count goes negative during subtraction or any leftover remains at the end, return INVALID. That's the one difference from the well-known version.
How hard is this problem really?+
Medium at most. There's no search or DP. Once you see the unique-letter ordering, it's about 30 lines. The INVALID check is the only place people slip. Test the examples abc and an empty string before submitting.
What's the time and space complexity?+
Time is O(n) for one pass counting letters, plus constant work for the ten digits. Space is O(1) since you only keep a 26-slot array and a 10-slot digit count. With length up to 100000, this is comfortably fast.
How do I prepare for this in 48 hours?+
Write the elimination order on paper and code it twice from memory. Then add the zero-check at the end and run edge cases: empty string, one stray letter, repeated digits like 'neonneo'. Don't memorize code, memorize the order and the reason each letter is unique.