Your question is Phone Dial Pad Combinations. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Signifyd's verification workflows may need to compare a phone number with candidate words entered through a standard mobile keypad. Given a digit string and a list of alphabetic strings, return every string whose letters map exactly to the phone number's digits.
Use this standard mapping: 2 = abc, 3 = def, 4 = ghi, 5 = jkl, 6 = mno, 7 = pqrs, 8 = tuv, and 9 = wxyz. Matching is case-insensitive, and the returned strings must preserve their original spelling and input order. A candidate matches only when it has the same length as the phone number and every character maps to the corresponding digit. Candidates contain letters only.
Implement filter_phone_words(phone_number, candidates), where phone_number is a string containing digits from 2 through 9, and candidates is a list of strings. Return a list containing all matching candidates. Duplicate candidates should appear as many times as they occur in the input.
Example 1
Input: phone_number = "43556", candidates = ["hello", "gel", "world", "HeLlO"]
Output: ["hello", "HeLlO"]
hello and HeLlO both map to 43556; gel has the wrong length.
Example 2
Input: phone_number = "8733", candidates = ["tree", "used", "test", "true"]
Output: ["tree", "used"]
Both tree and used map to 8733.
1 <= len(phone_number) <= 10^51 <= len(candidates) <= 10^410^510^6phone_number contains only digits 2 through 9def filter_phone_words(phone_number, candidates):