17. Letter Combinations of a Phone Number
来源:互联网 发布:数据字典怎么用 编辑:程序博客网 时间:2024/06/05 21:24
class Solution { public List<String> letterCombinations(String digits) { LinkedList<String> ans = new LinkedList<String>(); String[] mapping = new String[] {"0", "1", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; if (digits.contains("1")||digits.contains("0")||"".equals(digits))return ans; ans.add(""); for(int i =0; i<digits.length();i++){ int x = Character.getNumericValue(digits.charAt(i)); while(ans.peek().length()==i){ String t = ans.remove(); for(char s : mapping[x].toCharArray()) ans.add(t+s); } } return ans; }}
阅读全文
0 0
- 17.Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- dmesg命令
- 位段
- Python3:《机器学习实战》之k近邻算法(3)识别手写数字
- TCP通信的几种方式
- 爬虫实战之三--mysql安装
- 17. Letter Combinations of a Phone Number
- 64位ubuntu无法安装32位软件,或者是运行32位.run等文件,出现`no such file or directory`问题
- 十连测d1T3
- Java数据结构与算法解析(二)——栈
- PCIISA桥设计和实现
- 计算机网络的结构
- make makefile cmake qmake
- ZOJ1516_Uncle Tom's Inherited Land_二分图(匈牙利算法)
- 元组UPLE:戴上了枷锁的列表--2017/9/3--1