leetcode--Letter Combinations of a Phone Number
来源:互联网 发布:空间域名绑定建站教程 编辑:程序博客网 时间:2024/06/07 16:53
class Solution(object):
def letterCombinations(self, digits):
"""
:type digits: str
:rtype: List[str]
"""
if ''==digits:
return []
numsmap={
'2':'abc',
'3':'def',
'4':'ghi',
'5':'jkl',
'6':'mno',
'7':'pqrs',
'8':'tuv',
'9':'wxyz'}
return reduce(lambda acc,digit:[x+y for x in acc for y in numsmap[digit]],digits,[''])
def letterCombinations(self, digits):
"""
:type digits: str
:rtype: List[str]
"""
if ''==digits:
return []
numsmap={
'2':'abc',
'3':'def',
'4':'ghi',
'5':'jkl',
'6':'mno',
'7':'pqrs',
'8':'tuv',
'9':'wxyz'}
return reduce(lambda acc,digit:[x+y for x in acc for y in numsmap[digit]],digits,[''])
0 0
- LeetCode: Letter Combinations of a Phone Number
- LeetCode Letter Combinations of a Phone Number
- LeetCode: Letter Combinations of a Phone Number
- [Leetcode] Letter Combinations of a Phone Number
- [LeetCode] Letter Combinations of a Phone Number
- 【leetcode】Letter Combinations of a Phone Number
- LeetCode: Letter Combinations of a Phone Number
- [LeetCode]Letter Combinations of a Phone Number
- LeetCode-Letter Combinations of a Phone Number
- [LeetCode] Letter Combinations of a Phone Number
- LeetCode - Letter Combinations of a Phone Number
- LeetCode:Letter Combinations of a Phone Number
- LeetCode | Letter Combinations of a Phone Number
- leetcode Letter Combinations of a Phone Number
- Leetcode: Letter Combinations of a Phone Number
- 【leetcode】Letter Combinations of a Phone Number
- [LeetCode] Letter Combinations of a Phone Number
- leetcode: Letter Combinations of a Phone Number
- 关于 transform:matrix(1,0,0,1,0,0)
- [Java]常用的八种排序算法与代码实现
- Android 主要流行框架简介
- 利用订阅模式实现缓存更新
- Makefile使用详解[转载]
- leetcode--Letter Combinations of a Phone Number
- PAT_1023. Have Fun with Numbers
- 用LabVIEW仿真出我们身边的实用温度小器材
- Spring注解@Component、@Repository、@Service、@Controller区别
- BZOJ P1570[JSOI2008]Blue Mary的旅行
- css如何清除浮动(三)
- 竖向Viewpager(3D翻动效果画廊)
- GitHub IOS 框架 Top 100 简介
- Maven搭建的SSM项目中遇到的问题