Gamified challenge · Backtracking
On an old phone keypad each key 2–9 also stands for letters: 2 abc, 3 def, 4 ghi, 5 jkl, 6 mno, 7 pqrs, 8 tuv, 9 wxyz. A phone number spells a word by choosing one letter for each digit, in order.
Write keypadWords(digits) (Python: keypad_words(digits)) that returns every lowercase word the digits can spell, each once, in any order. If digits is empty, return an empty list.
Example: digits = "23" gives ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].
This game is part of the paid plans. Sign in, then pick a plan to write your answer, watch it play out, and step through the algorithm with its guide.
Sign in with Google