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_;
}
};

Leetcode 17. Letter Combinations of a Phone Number(水)的更多相关文章

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

    Given a string containing digits from 2-9inclusive, return all possible letter combinations that the ...

  2. [leetcode 17]Letter Combinations of a Phone Number

    1 题目: Given a digit string, return all possible letter combinations that the number could represent. ...

  3. Java [leetcode 17]Letter Combinations of a Phone Number

    题目描述: Given a digit string, return all possible letter combinations that the number could represent. ...

  4. Leetcode 17.——Letter Combinations of a Phone Number

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

  5. [leetcode]17. Letter Combinations of a Phone Number手机键盘的字母组合

    Given a string containing digits from 2-9 inclusive, return all possible letter combinations that th ...

  6. [LeetCode] 17. Letter Combinations of a Phone Number ☆☆

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

  7. [LeetCode]17. Letter Combinations of a Phone Number电话号码的字母组合

    Given a string containing digits from 2-9 inclusive, return all possible letter combinations that th ...

  8. LeetCode——17. Letter Combinations of a Phone Number

    一.题目链接: https://leetcode.com/problems/letter-combinations-of-a-phone-number/ 二.题目大意: 给定一段数字字符串,其中每个数 ...

  9. LeetCode 17 Letter Combinations of a Phone Number (电话号码字符组合)

    题目链接 https://leetcode.com/problems/letter-combinations-of-a-phone-number/?tab=Description HashMap< ...

随机推荐

  1. IDEA激活—免费永久激活(lookdiv.com)

    网址: http://lookdiv.com/ 钥匙就是网址 钥匙:lookdiv.com 亲测有效!非常好用.

  2. Java多线程学习——wait方法(管道法/生产者消费者模式)

    简单介绍管道法: 生产者生产数据输送到管道,消费者从管道拿出数据,管道为空消费者等待,管道满生产者生产,消费者消费生产者生产,生产者生产消费者消费. public class Corn { //要生产 ...

  3. 【HBase】二、HBase实现原理及系统架构

      整个Hadoop生态中大量使用了master-slave的主从式架构,如同HDFS中的namenode和datanode,MapReduce中的JobTracker和TaskTracker,YAR ...

  4. 第三章 四大组件之Activity(一)生命周期

    1.生命周期: onCreate()->onStart()->onResume()->onPause()->onStop()->onDestroy() 2.各种状况下Ac ...

  5. 使用logstash收集java、nginx、系统等常见日志

    目录 1.使用codec的multiline插件收集java日志... 1 2.收集nginx日志... 2 3.收集系统syslog日志... 3 4.使用fliter的grok模块收集mysql日 ...

  6. 防抖和节流 lodash插件

    lodash.debounce lodash.debounce(function(){ },1000) 函数防抖原理 调用函数时,马上清理定时器.然后再设置一个定时器包含函数

  7. Tomcat 一台机器运行多个Tomcat

    转 https://www.cnblogs.com/andy1234/p/8866588.html 在一台Win10 PC 上面同时开启两个Tomcat系统为例. 1. 硬件环境 2. 到Tomcat ...

  8. pycharm链接数据库以及连接时候出现错误的集合

    1.pycharm如何直接连接数据库? 作用:这是一种管理数据库的方式而已,因为在开发过程中结合使用还是不错的!当然,还有有很多管理数据库的工具和方法. 比如:navicat工具 1.1  如何找到管 ...

  9. mailto - 简单多媒体邮件发送程序

    SYNOPSIS mailto  [-a] [-c] [-s] [recipient name(s)] DESCRIPTION mailto 程序是一个用于发送MIME格式的多媒体邮件(MIME格式是 ...

  10. Qt是什么?Qt简介(非常全面)

    http://c.biancheng.net/view/1792.html Qt(官方发音 [kju:t],音同 cute)是一个跨平台的 C++ 开发库,主要用来开发图形用户界面(Graphical ...