-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path16-letterCombinations.h
More file actions
58 lines (44 loc) · 976 Bytes
/
16-letterCombinations.h
File metadata and controls
58 lines (44 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#include <iostream>
#include <algorithm>
#include <string.h>
#include <vector>
#include <map>
using namespace std;
class SolutionletterCombinations
{
public:
std::vector<std::string> letterCombinations(std::string digits);
protected:
private:
};
std::vector<std::string> SolutionletterCombinations::letterCombinations(std::string digits)
{
std::map<std::string, std::string> strMap;
strMap["0"] = "";
strMap["1"] = "";
strMap["2"] = "abc";
strMap["3"] = "def";
strMap["4"] = "ghi";
strMap["5"] = "jkl";
strMap["6"] = "mno";
strMap["7"] = "pqrs";
strMap["8"] = "tuv";
strMap["9"] = "wxyz";
std::vector<std::string> vecStr;
int nSize = digits.length();
for (int iLoop = 0; iLoop < nSize; ++iLoop)
{
string strLetter;
string strTmp = digits.substr(iLoop, 1);
string str = strMap[strTmp];
int nlen = str.length();
for (int i = 0; i < nlen; ++i)
{
char p = str.at(i);
for (size_t i = 0; i < 10; i++)
{
}
}
}
}