Given a string containing digits from 2 to 9, return all possible letter combinations that the number could represent.
A mapping of digits to letters (like on a phone keypad) is given below. Note that 1 does not map to any letters.
digitsInput: "23" Output: ["ad","ae","af","bd","be","bf","cd","ce","cf"]
Input: "" Output: []
Input: "2" Output: ["a","b","c"]
Output must be printed as a JSON array of strings.
print(str(fuctionname(x)).replace(" ", "")) In Python
No submissions yet.
Discuss backtracking, recursion depth, and iterative BFS approaches.