leetcode:Letter Combinations of a Phone Number [17]
来源:互联网 发布:数据库qps 编辑:程序博客网 时间:2024/05/03 21:03
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 {public:void pu(string digits, int i, vector<string> *a) {if (i == digits.length() - 1) {}}vector<string> letterCombinations(string digits) {string a[11] = { "","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz" };vector<string> s1;deque<string> deq;if (digits.empty()) return s1;string s;for (int i = 0; i < a[digits[0] - '0'].length(); i++) {s = s + a[digits[0] - '0'][i];deq.push_back(s);s = "";}while (deq[0].length() < digits.length()) {string t = "";for (int i = 0; i < a[digits[deq[0].length()] - '0'].length(); i++) {deq.push_back(deq[0] + a[digits[deq[0].length()] - '0'][i]);}deq.pop_front();}for (int i = 0; i < deq.size(); i++) {s1.push_back(deq[i]);}return s1;}};
0 0
- LeetCode: 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
- [LeetCode] 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
- LeetCode-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
- LeetCode | 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
- [LeetCode] Letter Combinations of a Phone Number
- leetcode: Letter Combinations of a Phone Number
- 处理过拟合问题
- IntentService详解
- ExceptionUtils.getFullStackTrace
- Java中文件的切割与合并
- 奇技淫巧之节省输入输出时间
- leetcode:Letter Combinations of a Phone Number [17]
- Windows系统配置java环境
- Notepad++如何自动缩进(格式化)c++\java代码
- 关于终端和控制台,以及自己的测试
- Android Webview截屏
- 开发 三
- 文章标题
- git flow
- 正版Windows7 OEM初级版升级到各版本(Lenovo/ThinkPad/ThinkCentre品牌)的密钥