MCPcopy Create free account
hub / github.com/chaharnishant11/CodeIn10DSA / Solution

Class Solution

Recursion/Homework/possibleWordsFromPhone.cpp:13–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11//User function Template for C++
12
13class Solution
14{
15 public:
16 vector<string> keys = {"","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
17 vector<string> ans;
18 //Function to find list of all words possible by pressing given numbers.
19 void helper(int a[],int n,string temp,int i){
20 if (i==n){
21 ans.push_back(temp);
22 return;
23 }
24 for (int j=0;j<keys[a[i]].size();j++){
25 helper(a,n,temp+keys[a[i]][j],i+1);
26 }
27 }
28 vector<string> possibleWords(int a[], int N)
29 {
30 //Your code here
31 helper(a,N,"",0);
32 return ans;
33 }
34};
35
36
37// { Driver Code Starts.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected