Meta interview question

easy leet code style problem solved with prefix trees