Tuesday, July 1, 2014

[Leetcode] Letter Combinations of Phone Number

Problem


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.
[1,2,3,4,5,6,7,8,9,9] = {"",   "abc",  "def""ghi""jkl",  "mno""pqrs","tuv",  "wxyz","0" };
Input:Digit string "23"

Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].

No comments:

Post a Comment