File tree Expand file tree Collapse file tree 3 files changed +49
-2
lines changed Expand file tree Collapse file tree 3 files changed +49
-2
lines changed Original file line number Diff line number Diff line change 8383 - [ 669. 修剪二叉搜索树] ( ./day23/lc669.md )
8484 - [ 108. 将有序数组转换为二叉搜索树] ( ./day23/lc108.md )
8585 - [ 538. 把二叉搜索树转换为累加树] ( ./day23/lc538.md )
86- - [ day 24]
86+ - [ day 24] ( ./day24.md )
8787 - [ 77. 组合] ( ./day24/lc77.md )
88- - [ 216. 组合总和 III] ( ./day24/lc216.md )
88+ - [ day 26] ( ./day26.md )
89+ - [ 216. 组合总和 III] ( ./day26/lc216.md )
Original file line number Diff line number Diff line change 1+ # 17. 电话号码的字母组合
2+
3+ ## 题目描述
4+
5+ 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。答案可以按 任意顺序 返回。
6+
7+ 给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。
8+
9+ ## 解题思路
10+
11+ ``` cpp
12+ class Solution {
13+ public:
14+ const string a[ 10] = {
15+ "", // 0
16+ "", // 1
17+ "abc", // 2
18+ "def", // 3
19+ "ghi", // 4
20+ "jkl", // 5
21+ "mno", // 6
22+ "pqrs", // 7
23+ "tuv", // 8
24+ "wxyz", // 9
25+ };
26+ vector<string >res;
27+ string cur;
28+ string digits;
29+ void b(int start) {
30+ if(cur.size()==digits.size()){res.push_back(cur);return;}
31+ string letters=a[ digits[ start] -'0'] ;
32+ for(char c: letters ){
33+ cur.push_back(c);
34+ b(start+1);
35+ cur.pop_back();
36+ }
37+ }
38+ vector<string > letterCombinations(string digits) {if(digits.size()==0)return vector<string >{};
39+ this->digits=digits;b(0);return res;
40+ }
41+ };
42+ ```
43+
44+
45+
46+ ## 学习感想
File renamed without changes.
You can’t perform that action at this time.
0 commit comments