Back to problems

Recover Sorted Digits from Scrambled English Number Words

Algorithm · Microsoft · Medium

You are given a string s consisting only of lowercase English letters. The letters are a random shuffling of the characters that appear in some multiset of the English digit words: "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", and "nine". Each digit word may be used zero or more times, and the order of letters and word boundaries has been completely lost. Determine which digits were used to produce the letter collection, and return them as a string…

Checking your access…