From 8bbcdfb21ae07d25f1f06a0a33e0786197cf49b9 Mon Sep 17 00:00:00 2001 From: Coder-2022 <93146396+Coder-2022@users.noreply.github.com> Date: Mon, 25 Oct 2021 21:26:27 +0530 Subject: [PATCH] Create Print_Keypad_Combinations_Code.cpp --- CPP/Print_Keypad_Combinations_Code.cpp | 70 ++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 CPP/Print_Keypad_Combinations_Code.cpp diff --git a/CPP/Print_Keypad_Combinations_Code.cpp b/CPP/Print_Keypad_Combinations_Code.cpp new file mode 100644 index 0000000..c8a5890 --- /dev/null +++ b/CPP/Print_Keypad_Combinations_Code.cpp @@ -0,0 +1,70 @@ +/* Given an integer n, using phone keypad find out and print all the possible strings that can be made using digits of input n. +Note : The order of strings are not important. Just print different strings in new lines. +Input Format : +Integer n +Output Format : +All possible strings in different lines +Constraints : +1 <= n <= 10^6 +Sample Input: +23 +Sample Output: +ad +ae +af +bd +be +bf +cd +ce +cf */ + + + +#include +#include +using namespace std; + +void printer(string* temp, int n, string output) +{ + if (n==0) + { + cout << output << endl; + return; + } + int last_digit = n % 10; + string s = temp[last_digit]; + + for(int i=0; i> num; + + printKeypad(num); + + return 0; +}