题目描述:(链接)
Given a digit string, return all possible letter combinations that the number could represent.
A mapping of digit to letters (just like on the telephone buttons) is given below.
Input:Digit string "23" Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].
Note:
Although the above answer is in lexicographical order, your answer could be in any order you want.
解题思路:
递归方式,深度优先搜索
1 class Solution { 2 public: 3 vector<string> letterCombinations(string digits) { 4 vector<string> result; 5 if (digits == "") return result; 6 vector<string> keyboard {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; 7 string midResult(digits.size(), '