17. Letter Combinations of a Phone Number
17. Letter Combinations of a Phone Number - Medium
Description¶
17. Letter Combinations of a Phone Number
Given a string containing digits from 2-9
inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.
A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.
这道题与22. Generate Parentheses一样的思路。
Solution¶
最近在学 Scala,这道题只用 Scala 写了。Java写也是一样的写法,语法不通而已。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|