给出一个仅包含数字的字符串,给出所有可能的字母组合。 数字到字母的映射方式如下:(就像电话上数字和字母的映射一样) Input:Digit string "23"Output:["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]. 注意:虽然上述答案是按字典序排列的,但你的答案可以按任意的顺序给出
示例1
输入
"23"
输出
["ad","ae","af","bd","be","bf","cd","ce","cf"]
加载中...
import java.util.*; public class Solution { /** * * @param digits string字符串 * @return string字符串ArrayList */ public ArrayList
letterCombinations (String digits) { // write code here } }
class Solution { public: /** * * @param digits string字符串 * @return string字符串vector */ vector
letterCombinations(string digits) { // write code here } };
# # # @param digits string字符串 # @return string字符串一维数组 # class Solution: def letterCombinations(self , digits ): # write code here
/** * * @param digits string字符串 * @return string字符串一维数组 */ function letterCombinations( digits ) { // write code here } module.exports = { letterCombinations : letterCombinations };
# # # @param digits string字符串 # @return string字符串一维数组 # class Solution: def letterCombinations(self , digits ): # write code here
package main /** * * @param digits string字符串 * @return string字符串一维数组 */ func letterCombinations( digits string ) []string { // write code here }
"23"
["ad","ae","af","bd","be","bf","cd","ce","cf"]