A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

17. Letter Combinations of a Phone Number

Given a digit string, 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.
1      2      3
4      5      6
7      8      9
*      0       #
Input:Digit string "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.

给一个数字的字符串,返回那些数字可能代表的全部的字母组合。

2 = "abc", 3 = "def", 4 = "ghi", 5 = "jkl", 6 = "mno", 7 = "pqrs", 8 = "tuv", 9 = "wxyz"

输入:数字字符串 “23”输出:["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].
注意:
尽管上述的答案是按词典顺序排列的,你的答案可以用任何你想要的顺序排列。

你需要完成以下函数:
/**
* Return an array of size *returnSize.
* Note: The returned array must be malloced, assume caller calls free().
*/
char** letterCombinations(char* digits, int* returnSize) {

}


这道题的网址是:“https://leetcode.com/problems/letter-combinations-of-a-phone-number/#/description“

1 个回复

倒序浏览
占楼,待发答案。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马