LeetCode17. Letter Combinations of a Phone Number
来源:互联网 发布:linux搭建php开发环境 编辑:程序博客网 时间:2024/05/16 01:54
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”].
class Solution {private: vector<string> res; void letterCombinations(string digits,int b,string s,string d[]){ int n=digits.length(); if(b==n){ res.push_back(s); }else{ for(int i=0;i<d[digits[b]-'0'].length();++i){ letterCombinations(digits,b+1,s+d[digits[b]-'0'][i],d); } } }public: vector<string> letterCombinations(string digits) { string strs[]={"","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz",}; string s=""; int n=digits.length(); if(n==0) return res; letterCombinations(digits,0,s,strs); return res; }};
0 0
- [LeetCode17]Letter Combinations of a Phone Number
- LeetCode17:Letter Combinations of a Phone Number
- leetcode17 Letter Combinations of a Phone Number
- LeetCode17:Letter Combinations of a Phone Number
- leetcode17---Letter Combinations of a Phone Number
- LeetCode17. Letter Combinations of a Phone Number
- leetcode17:Letter Combinations of a Phone Number
- LeetCode17. Letter Combinations of a Phone Number
- leetcode17. Letter Combinations of a Phone Number
- leetcode17 Letter Combinations of a Phone Number
- [Java]LeetCode17 Letter Combinations of a Phone Number
- LeetCode17. Letter Combinations of a Phone Number可能是世界上最简明的解法了
- LeetCode17 17. Letter Combinations of a Phone Number My Submissions QuestionEditorial Solution
- LeetCode17 Letter Combinations of a Phone Number(Python and Java)
- LeetCode17——Letter Combinations of a Phone Number(手机几个按键对应的字母(符号)组合)
- LeetCode: Letter Combinations of a Phone Number
- LeetCode Letter Combinations of a Phone Number
- LeetCode: Letter Combinations of a Phone Number
- 菜鸟于心
- Java同步并发容器类
- 数据库多表查询
- poj 2891 Strange Way to Express Integers(中国剩余定理)
- Javaweb 登录注册的实现
- LeetCode17. Letter Combinations of a Phone Number
- CI框架的配置和MVC的简单介绍
- 机器学习资料
- 文件读写
- 【JS基础】返回顶部效果
- 自动生成mysql表格的一个网页,没有ERStudio功能全
- Js_canvas_01
- Android随笔之——闹钟制作铺垫之AlarmManager详解
- matlab 生成伽罗华域中元素代码