<p>Given a string containing digits from <code>2-9</code> inclusive, return all possible letter combinations that the number could represent. Return the answer in <strong>any order</strong>.</p>

<p>A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.</p>
<img alt="" src="https://assets.leetcode.com/uploads/2022/03/15/1200px-telephone-keypad2svg.png" style="width: 300px; height: 243px;" />
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> digits = &quot;23&quot;
<strong>Output:</strong> [&quot;ad&quot;,&quot;ae&quot;,&quot;af&quot;,&quot;bd&quot;,&quot;be&quot;,&quot;bf&quot;,&quot;cd&quot;,&quot;ce&quot;,&quot;cf&quot;]
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> digits = &quot;&quot;
<strong>Output:</strong> []
</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>
<strong>Input:</strong> digits = &quot;2&quot;
<strong>Output:</strong> [&quot;a&quot;,&quot;b&quot;,&quot;c&quot;]
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>0 &lt;= digits.length &lt;= 4</code></li>
	<li><code>digits[i]</code> is a digit in the range <code>[&#39;2&#39;, &#39;9&#39;]</code>.</li>
</ul>

class Solution {
public:
    void fun(int size,int idx,string& digits,vector<string>& ans,string& substr,unordered_map<int,vector<char>> mpp){
        if(idx >= size){
            ans.push_back(substr);
            return;
        }
        int digit = digits[idx] - '0';
        int sizeoftheloop = mpp[digit].size();
        vector<char> characters = mpp[digit];

        for(int i=0;i<sizeoftheloop;i++){
            char ch = characters[i];
            substr.push_back(ch);
            fun(size,idx+1,digits,ans,substr,mpp);
            substr.pop_back();
        }
        return; 
    }
    vector<string> letterCombinations(string digits) {
        int size = digits.size();
        vector<string> ans;
        if(size == 0){
            return ans;
        }
        unordered_map<int,vector<char>> mpp;
        mpp[2]={'a','b','c'}; 
        mpp[3]={'d','e','f'}; 
        mpp[4]={'g','h','i'}; 
        mpp[5]={'j','k','l'}; 
        mpp[6]={'m','n','o'}; 
        mpp[7]={'p','q','r','s'}; 
        mpp[8]={'t','u','v'}; 
        mpp[9]={'w','x','y','z'}; 
        
        string substr ="";
        int idx = 0;
        fun(size,idx,digits,ans,substr,mpp);
        return ans;
    }
};
10000