Programming Question: Leetcode-17
Approach to solve question leetcode — 17 Letter Combinations of a Phone Number
- For solving the problem recursively, we need helper function , in which digits, result and empty string (current string) will be passed as well as there will be a function which will return corresponding characters for each digit.
- for each number in digits , we will get possible characters of that number (for 2 ‘abc’ , for 3 ‘def’ like that).
- We will add each possible character into the current string and call the function recursively starting form next digit.
- then we cut the current string from end otherwise it will be added in next steps recursively.