Back to problems

Phone Number Word Matching

Algorithm · LinkedIn · Medium

A traditional mobile keypad assigns letters to digit keys: '2' → "abc", '3' → "def", '4' → "ghi", '5' → "jkl", '6' → "mno", '7' → "pqrs", '8' → "tuv", '9' → "wxyz", '0' → " " (a single space). The '1' key produces no letters. You are provided with a collection of lowercase English words called knownWords, and a string of digits phoneNumber containing characters from '0' to '9'. We say a word matches the digit string if you can map each digit in phoneNumber to one of its…

Checking your access…