17. Letter Combinations of a Phone Number
Medium

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<string> letterCombinations(string digits) {
map<char,string> test;
test[''] = "abc";
test[''] = "def";
test[''] = "ghi";
test[''] = "jkl";
test[''] = "mno";
test[''] = "pqrs";
test[''] = "tuv";
test[''] = "wxyz";
vector<string> fa_;
vector<string> chil_;
fa_.push_back("");
for(int i = ; i < digits.length(); i++){
chil_.clear();
for(int j = ; j < fa_.size(); j++){
//printf("%d %s",test[digits[i]].length());
for(int k = ; k < test[digits[i]].length(); k++){
//printf("%s",test[digits[i]][k]);
chil_.push_back(fa_[j]+test[digits[i]][k]);
}
}
fa_ = chil_;
}
return chil_;
}
};

最新文章

  1. MongoDB学习笔记—Linux下搭建MongoDB环境
  2. MyBatis入门(一)
  3. BZOJ 1191 【HNOI2006】 超级英雄Hero
  4. 使用Git时一些问题的处理
  5. Linux_rsyslogd日志服务(二)
  6. SQL Server 中字符串中包含字符串变量的表示方法
  7. I.MX6 SHT20 Linux 驱动移植
  8. infusion度量金字塔数据解释
  9. android错误 Android NAND: nand_dev_load_disk_state,
  10. 李洪强漫谈iOS开发[C语言-021]-运算符
  11. C# - winform使用Dictionary的时候,程序一闪而过!
  12. (转)asp.net动态设置标题title 关键字keywords 描述descrtptions
  13. C#生成高清缩略图
  14. 模板基础model
  15. 保持ssh连接长时间不断开的技巧
  16. 对vue.js的template编译的理解
  17. linux命令学习之:cp
  18. 运行msckf_vio
  19. logrotate 日志切割工具
  20. SpringBoot学习:使用spring-boot-devtools进行热部署

热门文章

  1. 【Qt开发】【VS开发】【Linux开发】OpenCV、Qt-MinGw、Qt-msvc、VS2010、VS2015、Ubuntu Linux、ARM Linux中几个特别容易混淆的内容
  2. kafka学习(四)
  3. 20191110 Spring Boot官方文档学习(4.1)
  4. MySQL插入emoji表情报错 SQLException: Incorrect string value 的两种解决方案
  5. python爬取b站排行榜
  6. [LeetCode] 137. 只出现一次的数字 II
  7. RocksDB Rate Limiter源码解析
  8. jQuery中$()可以有两个参数
  9. maven项目pom.xml报错: Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from
  10. Linux架构之Nginx 常见问题