category-wise-problems

contains category wise problems(data structures, competitive) of popular platforms.

View the Project on GitHub mayankdutta/category-wise-problems

Tags: strings backtracking brute-force

17. Letter Combinations of a Phone Number

Implementation ```cpp class Solution { public: string s; vector ans; map<char, string> mp; void fun(string digits) { if (digits.empty()) { if (!s.empty()) ans.push_back(s); return; } for (const char& ch: mp[digits.front()]) { s.push_back(ch); fun(digits.substr(1)); s.pop_back(); } } vector letterCombinations(string digits) { mp['2'] = "abc"; mp['3'] = "def"; mp['4'] = "ghi"; mp['5'] = "jkl"; mp['6'] = "mno"; mp['7'] = "pqrs"; mp['8'] = "tuv"; mp['9'] = "wxyz"; fun(digits); return ans; } }; ``` </details>