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.

Input:Digit string "23"
Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].
  vector<string> letterCombinations(string digits) {
string trans[] = {"", " ", "abc", "def", "ghi", "jkl",
"mno", "pqrs", "tuv", "wxyz"};
vector<string> set;
string seq;
Generater(trans, digits, , seq, set);
return set;
}
void Generater(string trans[], string& digits,
int deep, string& result, vector<string>& set)
{
if(deep == digits.size())
{
set.push_back(result);
return;
}
int curDig = digits[deep] - ;
for(int i =; i < trans[curDig].size(); i++)
{
result.push_back(trans[curDig][i]);
Generater(trans, digits, deep+, result, set);
result.resize(result.size() -);
}
}

Letter Combinations of a Phone Number的更多相关文章

  1. [LintCode] Letter Combinations of a Phone Number 电话号码的字母组合

    Given a digit string, return all possible letter combinations that the number could represent. A map ...

  2. 69. Letter Combinations of a Phone Number

    Letter Combinations of a Phone Number Given a digit string, return all possible letter combinations ...

  3. 【leetcode】Letter Combinations of a Phone Number

    Letter Combinations of a Phone Number Given a digit string, return all possible letter combinations ...

  4. [LeetCode][Python]17: Letter Combinations of a Phone Number

    # -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com' 17: Letter Combinations of a Phone Numb ...

  5. Letter Combinations of a Phone Number:深度优先和广度优先两种解法

    Letter Combinations of a Phone Number Given a digit string, return all possible letter combinations ...

  6. leetcode-algorithms-17 Letter Combinations of a Phone Number

    leetcode-algorithms-17 Letter Combinations of a Phone Number Given a string containing digits from 2 ...

  7. 《LeetBook》leetcode题解(17):Letter Combinations of a Phone Number[M]

    我现在在做一个叫<leetbook>的免费开源书项目,力求提供最易懂的中文思路,目前把解题思路都同步更新到gitbook上了,需要的同学可以去看看 书的地址:https://hk029.g ...

  8. Letter Combinations of a Phone Number - LeetCode

    目录 题目链接 注意点 解法 小结 题目链接 Letter Combinations of a Phone Number - LeetCode 注意点 可以不用按字典序排序 解法 解法一:输入的数字逐 ...

  9. LeetCode: Letter Combinations of a Phone Number 解题报告

    Letter Combinations of a Phone Number Given a digit string, return all possible letter combinations ...

  10. [LeetCode]Letter Combinations of a Phone Number题解

    Letter Combinations of a Phone Number: Given a digit string, return all possible letter combinations ...

随机推荐

  1. linux下xampp集成包安装配置方法

    1.查看你linux系统的位数,是32位的还是64位的.使用uname -a命令查看. 显示有 x86_64则说明你是64位内核, 跑的是64位的系统. i386, i686说明你是32位的内核, 跑 ...

  2. Matlab基础

    基本运算: 一,矩阵的生成 clc ; clear all; close all; 1.直接输入 A = [ 1 ,2 ,3,4;2,3,4,5;3,4,5,6] A = 1 2 3 4 2 3 4 ...

  3. Android高薪之路-Android程序员面试宝典

    Android高薪之路-Android程序员面试宝典

  4. msf生成shellcode

    msfpayload windows/exec CMD = calc.exe EXITFUNC=thread C 在kali Linux2.0新版中msfpayload命令已删除,功能已集成到msfv ...

  5. 解决win7资源监视器不能开启

    刚开始时是这样,点击开始监控,无效 需要开始服务即可解决

  6. 解决办法-错误:Access denied for user 'root'@'localhost' - java

    如下更改密码即可 mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';mysql> FLUS ...

  7. javascript笔记2-引用类型

    引用类型是一种数据结构,用于将数据和功能组织在一起.它描述的是一类对象所具有的属性和方法.Object是一个基础类型,Array是数组类型,Date是日期类型,RegExp是正则表达式类型,等. Ob ...

  8. (spring-第5回【IoC基础篇】)spring容器从加载配置文件到实例化bean的内部工作机制

    前面讲过,spring的生命周期为:实例化前奏-->实例化-->实例化后期-->初始化前期-->初始化-->初始化后期-->bean的具体调用-->销毁前-- ...

  9. ES6:模块简单解释

    modules是ES6引入的最重要的一个特性. 以后写模块的时候就直接按照ES6的modules语法来写 ,然后用babel+browserify 来打包就行了. modules规范分两部分,一部分是 ...

  10. BZOJ 2292 永远挑战

    最短路. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm&g ...