Leetcode Week11
来源:互联网 发布:中国跨境电子商务数据 编辑:程序博客网 时间:2024/05/22 15:04
/*
Letter Combinations of a Phone Number
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: vector<string> letterCombinations(string digits) { vector<string> res; string charmap[10] = {"0","1","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"}; if(digits.size()==0) return res; res.push_back(""); for(int i=0;i<digits.size();i++) { vector<string> temp; string chars = charmap[digits[i]-'0']; for(int c=0;c<chars.size();c++) { for(int j=0;j<res.size();j++) { temp.push_back(res[j]+chars[c]); } } res = temp; } return res; }};
0 0
- Leetcode Week11
- leetcode week11
- Leetcode Week11
- LeetCode Week11: Burst Ballons
- LeetCode题解 week11
- Leetcode: 43.Multiply Strings(Week11, Medium)
- week11-leetcode #451-Sort-Characters-By-Frequency
- 算法设计Week11 LeetCode Algorithms Problem #303 Range Sum Query
- [LeetCode-Algorithms-48] "Rotate Image" (2017.11.16-WEEK11)
- LeetCode#238 Product of Array Except Self (week11)
- week6-week11
- Algorithm-week11
- 算法Week11.01 - LeetCode 452. Minimum Number of Arrows to Burst Balloons
- 算法设计Week11 LeetCode Algorithms Problem #304 Range Sum Query 2D
- [LeetCode-Algorithms-19] "Remove Nth Node From End of List" (2017.11.16-WEEK11)
- C程序设计Week11作业
- No11.week11 maxSubArray
- sql server code week11
- Servlet 表单数据
- 微框架 spring boot
- 反向代理-ngrok for wechat
- struts2面试题
- vmtouch命令
- Leetcode Week11
- Java概念性问题5
- AES算法的Java实现,直接对String操作
- windows下安装yarn出现python问题解决命令
- LSApplicationWorkspace
- JVM(十一) 运行时包
- Phpstorm索引文件路径配置 左侧目录背景色配置
- Python3.6实现PostgreSql数据表备份与恢复
- etc/fstab 文件详解