Your question is T9 Dictionary Implementation. 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.
Chime's mobile app can offer word suggestions while a user enters digits on a T9-style keypad. Given a dictionary of lowercase words, return all words whose T9 encoding starts with a supplied digit prefix.
Implement t9_suggestions(words, digits, limit). The result must be sorted lexicographically and contain at most limit words. Each input word is unique, and the digit mapping is 2=abc, 3=def, 4=ghi, 5=jkl, 6=mno, 7=pqrs, 8=tuv, and 9=wxyz.
def t9_suggestions(words, digits, limit):