leetcode: Letter Combinations of a Phone Number
来源:互联网 发布:淘宝背景 编辑:程序博客网 时间:2024/06/06 04:39
还是回溯
class Solution {public: vector<string> letterCombinations(string digits) { if(digits == "") return vector<string>(1,""); vector< string> res; core( digits, res, "", 0); return res; } void core( const string &digits, vector< string> &res, string str, int pos){ if( pos == digits.size()){ res.push_back(str); return; } const static string letter[10] = {"","","abc","def","ghi","jkl","mno","qprs","tuv","wxyz"}; for( int i = 0; i < letter[digits[pos]-'0'].size(); ++i){ core( digits, res, str+letter[digits[pos]-'0'][i], pos+1); } }};
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
- 触发器
- java并发小结
- MySql按周/月/日分组统计数据的方法
- SQL 2008存储图片和读取图片
- 投资理财幸福指数四原则
- leetcode: Letter Combinations of a Phone Number
- IAR for AVR_Proteus—联合调制
- 简单配置struts2
- java单元测试技术
- Reorg
- Spring注释@Autowired @Resource @Qualifier @Required @Resource @Component,@Service,@Controller,@Reposit
- BASH 文本模版的简单实现 micro_template_compile
- 初学maven(2)-maven/artifactory/m2eclipse安装全过程
- 30天自制操作系统(第一天)