← Questions

Predictive text for a phone keypad

0
xAICodingLast asked Jun 2025

On a phone keypad each digit maps to several letters (2 = abc, 3 = def, ...). Given a dictionary and a sequence of digit presses, return the words the sequence could spell, T9 style. Build a trie (or index words by their digit sequence) so lookups are fast, and discuss suggesting longer words that start with the sequence.

Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding