Letter Combinations of a Phone Number
来源:互联网 发布:601519历史交易数据 编辑:程序博客网 时间:2024/04/26 07:52
public ArrayList<String> letterCombinations(String digits) { // Start typing your Java solution below // DO NOT write main() function String[] combination = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; return letterCombinations(digits, 0, combination); } public ArrayList<String> letterCombinations(String digits, int index, String[] combination) { ArrayList<String> result = new ArrayList<String>(); if(index == digits.length()) { result.add(""); return result; }else { String tmp = combination[digits.charAt(index) - '0']; for(int i = 0; i < tmp.length(); i++){ for(String s : letterCombinations(digits, index + 1, combination)) { StringBuilder sb = new StringBuilder(); sb.append(tmp.charAt(i)); sb.append(s); result.add(sb.toString()); } } } return result; }
- LeetCode: Letter Combinations of a Phone Number
- LeetCode Letter Combinations of a Phone Number
- LeetCode: Letter Combinations of a Phone Number
- [Leetcode] Letter Combinations of a Phone Number
- [LeetCode] Letter Combinations of a Phone Number
- LeetCode18:Letter Combinations of a Phone Number
- Letter Combinations of a Phone Number
- 【leetcode】Letter Combinations of a Phone Number
- LeetCode: Letter Combinations of a Phone Number
- Letter Combinations of a Phone Number
- Letter Combinations of a Phone Number
- [LeetCode]Letter Combinations of a Phone Number
- LeetCode-Letter Combinations of a Phone Number
- Letter Combinations of a Phone Number
- [LeetCode] Letter Combinations of a Phone Number
- Letter Combinations of a Phone Number
- LeetCode - Letter Combinations of a Phone Number
- LeetCode:Letter Combinations of a Phone Number
- CentOS中iptables开放80端口
- c 语言中的 6 个关系运算符
- Js+XML字符串 操作并转成json格式字符串
- JS解析XML文件和XML字符串
- Js+XML 操作
- Letter Combinations of a Phone Number
- Android控件之HorizontalScrollView 去掉滚动条 用按钮控制滚动方向
- [每日一题] 11gOCP 1z0-052 :2013-09-5 runInstaller oracle of no swap.............................A36
- Interleaving String
- python19 函数和变量
- Javascript学习之消息框(一)
- python20 函数和文件
- 编程中常见的错误处理方式
- 随机图