Phone Combinations

BACKTRACKING

STRING

### Problem

A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.

```
2 - "abc"
3 - "def"
4 - "ghi"
5 - "jkl"
6 - "mno"
7 - "pqrs"
8 - "tuv"
9 - "wxyz"
```

**Note:** Although the problem statement might suggest otherwise, ensure your solution can handle inputs with multiple digits, generating all combinations recursively or iteratively.

### Examples

`letterCombinations("2"); // returns ["a","b","c"] // '2' could correspond to 'a', 'b', or 'c'. letterCombinations("23"); // returns ["ad","ae","af","bd","be","bf","cd","ce","cf"] // '2' corresponds to 'a', 'b', or 'c'; // '3' corresponds to 'd', 'e', or 'f' // The combinations are the product of these sets.`

Loading...