本文主要是介绍Leetcode || Letter Combinations of a Phone Number,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Given a digit string, return all possible letter combinations that the number could represent.
不知道有多少数字,很难遍历,那就用遍历的极端情况,递归
package pack;import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;class Solution {public List<String> letterCombinations(String digits) {HashMap<Integer, String> map = new HashMap<Integer, String>();map.put(2, "abc");map.put(3, "def");map.put(4, "g
这篇关于Leetcode || Letter Combinations of a Phone Number的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!