Recover Sorted Digits from Scrambled English Number Words
Company: Microsoft
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Overview: Recover sorted digits from scrambled English number-word letters, including repeats, and analyze why arbitrary customer vocabularies may lose unique recoverability.
Read the full Microsoft Software Engineer interview experience this question came from
Constraints
- 0 <= input length <= 100000; letters are lowercase ASCII.
- The input is guaranteed to be a valid multiset of complete fixed English digit names zero through nine.
- Letter order and word boundaries are arbitrary; empty input represents no digits.
- Return digits in nondecreasing order, preserving multiplicity.
Examples
Input: ('owoztneoer',)
Expected Output: '012'
Explanation: The letters contain zero, one and two without intact boundaries.
Input: ('fviefuro',)
Expected Output: '45'
Explanation: Shared f is resolved after removing four.