Letter Combinations of a Phone Number
来源:互联网 发布:问答软件名字 编辑:程序博客网 时间:2024/04/20 01:46
class Solution {public: string dic[10] = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; vector<string> res; void dfs(string& digits, string s, int cur, int len){ if(cur==len){ res.push_back(s); return; } int c = digits[cur] - '0'; for(int i = 0; i < dic[c].size(); i++){ s.push_back(dic[c][i]); dfs(digits, s, cur + 1, len); s.pop_back(); } return; } vector<string> letterCombinations(string digits) { const int len = digits.length(); if(len == 0) return res; string s; dfs(digits, s, 0, len); return res; }};
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
- LeetCode18:Letter Combinations of a Phone Number
- Letter Combinations of a Phone Number
- 【leetcode】Letter Combinations of a Phone Number
- LeetCode: Letter Combinations of a Phone Number
- Letter Combinations of a Phone Number
- Letter Combinations of a Phone Number
- [LeetCode]Letter Combinations of a Phone Number
- LeetCode-Letter Combinations of a Phone Number
- Letter Combinations of a Phone Number
- [LeetCode] Letter Combinations of a Phone Number
- Letter Combinations of a Phone Number
- LeetCode - Letter Combinations of a Phone Number
- LeetCode:Letter Combinations of a Phone Number
- 第6周项目3-括号的匹配
- X210烧写linux系统
- hdu4750Count The Pairs 并查集
- xUtils 源码解析
- HDU 4433 locker
- Letter Combinations of a Phone Number
- igrimaceV8.0.0 IG (三个插件安装方式)
- 达内学习日志Day20:Java核心API(Map初体验)
- Linux网络编程---ICMP协议分析及ping程序实现
- 数组中未出现的最小正整数
- 二级指针
- SparkSQL之数据源
- AFN文档中文翻译以及简单使用说明
- C#学习之多线程开发技术(九)