From 298f267737ac7faac7737e8a4f1fb28799d2b9da Mon Sep 17 00:00:00 2001 From: savarapu manohar joshi <83489094+Manohar-mj@users.noreply.github.com> Date: Sun, 30 Oct 2022 17:39:59 +0530 Subject: [PATCH] Create PhoneNumberLetterCombinations.cpp --- .../DEM2020/PhoneNumberLetterCombinations.cpp | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Codechef/DEM2020/PhoneNumberLetterCombinations.cpp diff --git a/Codechef/DEM2020/PhoneNumberLetterCombinations.cpp b/Codechef/DEM2020/PhoneNumberLetterCombinations.cpp new file mode 100644 index 0000000..ac75ab9 --- /dev/null +++ b/Codechef/DEM2020/PhoneNumberLetterCombinations.cpp @@ -0,0 +1,39 @@ +#include +using namespace std; + +int solve(string digits, int index, string maping_values[], string output){ + // base case + if(digits.length() == output.length()){ + cout << output << endl; + return 0; + } + int digit = digits[index] - '0'; + string char_digits = maping_values[digit]; + for(int i=0;i> digits; + string maping_values[] = {"", "", "abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"}; + solve(digits, 0, maping_values, ""); + return 0; +/* +23 +ad +ae +af +bd +be +bf +cd +ce +cf +*/ +}