电话号码的字母组合

This commit is contained in:
YuCheng Hu 2023-11-09 08:33:35 -05:00
parent 207d5f1470
commit afb2050216
No known key found for this signature in database
GPG Key ID: 942395299055675C
2 changed files with 32 additions and 0 deletions

View File

@ -1,3 +1,4 @@
- [电话号码的字母组合](/algorithm/letter-combinations-of-a-phone-number.md)
- [格雷编码](/algorithm/gray-code.md)
- [点积](/algorithm/dot-product.md)
- [二叉树](/algorithm/binary-tree.md)

View File

@ -0,0 +1,31 @@
# 电话号码的字母组合Letter Combinations of a Phone Number
> 🔔 参与讨论https://www.isharkfly.com/t/letter-combinations-of-a-phone-number/15121
## 描述
给定一个字符串,字符串中不包含 01。返回这个字符串中所有可能的字母组合返回结果。
数字和字母的的映射图片,请参考下面的电话拨号盘。
![](https://www.cwiki.us/download/thumbnails/41683838/keypad.jpg?version=1&modificationDate=1544901155000&api=v2)
## 样例
给定 `"23"`
返回 `["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]`
## 代码
GitHub 的源代码,请访问下面的链接:
https://github.com/honeymoose/codebank-algorithm/blob/main/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0425LetterCombinationsTest.java
## 点评
本题目主要考察你对递归调用的熟练使用程度。
有关递归调用的方法,请自行脑补,或者 Google 查询。
思路主要分 2 部分,第一部分存储使用的数据结构,你可以使用 Map 也可以使用数组,效果都是一样的。