[leetcode] 831. Masking Personal Information
855
2022-08-23
[leetcode] 17. Letter Combinations of a Phone Number
Description
Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.
A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.
Example:
Input: "23"Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].
Note:
Although the above answer is in lexicographical order, your answer could be in any order you want.
分析
题目的意思是:给定一串数字,然后求出所有的相应字母(如图)的字符串组合。
就是一个深度优先搜索的问题,要注意循环函数的参数以及递归终止条件就行了。其他的没什么难度。
代码
class Solution {public: vector 参考文献 [编程题]letter-combinations-of-a-phone-number[LeetCode] Letter Combinations of a Phone Number 电话号码的字母组合
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。