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“
|