
‘S’ = “112”.
Output: [aab, al, kb]
The possible ways to convert the given strings is:
aab => a = 1, a = 1, b = 2,
al => a = 1, l = 12
kb => k = 11, b = 2
Hence, the final array is: [aab, al, kb].
The first line will contain the integer 'T', denoting the number of test cases.
The first line of each test case contains a string ‘S’.
For each test case, you don’t need to print anything just return an array of all possible strings sorted in non-decreasing lexicographical order.
You don't need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= S.length <= 20
Sum of length of strings over all test cases <= 20
Time Limit: 1 sec
In this approach, For each character, we may have two possibilities, either we treat it as a single digit to get the character from 1 to 9 or we append the next digit with it. We recursively try all the possible combinations. We can use a set to store all the strings in sorted order.
Function convertDigitToAlpha(string digit):
// Function to check if the digit string is less than 27 or not.
// // Recursive function to get all possible strings.
Unique Paths III
Unique Paths III
Unique Paths III
Unique Paths III
Combination Sum III
Combination Sum III
Combination Sum III
Combination Sum III
Combination Sum III
8-Queen Problem
Sequential Digits
Expression Add Operators