-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeypad_using_trees.cc
More file actions
58 lines (48 loc) · 1.37 KB
/
keypad_using_trees.cc
File metadata and controls
58 lines (48 loc) · 1.37 KB
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
58
#include<iostream>
#include<string>
using namespace std;
void keypad(string input,string output){
string s1[10]={"","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
string temp;
//base case
if(input.length()==0)
cout<<output<<endl;
return;
//main function call
for(int i=0;i<s1[input.substr(0,1)].length;i++)
for(int j=0;j<)
keypad(input.substr(0,1),s1[]+output);
}
int main(){
string input;
cin>>input;
string output ="";
keypad(input,output);
}
// void printKeypad(int num){
// /*
// Given an integer number print all the possible combinations of the keypad. You do not need to return anything just print them.
// */
// string s1 = to_string(num);
// string output = "";
// printKeypad(s1,output);
// }
// void printKeypad(string input,string output)
// {
// string s1[10]={"","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
// string temp;
// //base case
// if(input.empty()){
// cout<<output<<endl;
// return;
// }
// int value = input.substr(0,1);
// int remaining = input.substr(1);
// int int_value = atoi(value);
// //main function call
// string value1=s1[int_value];
// for(int i=0;i<value1.length();i++)
// { string xoxo = s1[value1][i];
// printKeypad(remaining,output+xoxo);
// }
// }