leetcode 17. 电话号码的字母组合
程序员文章站
2022-04-16 23:53:20
...
没啥思路直接写就完了···
dict_ = {"2":"abc","3":"def","4":"ghi","5":"jkl","6":"mno","7":"pqrs","8":"tuv","9":"wxyz"}
res = []
for i in digits:
if len(res)==0:
res.extend([j for j in dict_[i]])
else:
res = [w+j for j in dict_[i] for w in res]
return res