Leetcode:Letter Combinations of a Phone Number

来源:互联网 发布:淘宝假台湾回流紫砂壶 编辑:程序博客网 时间:2024/04/28 15:04

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.

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




Solution:

Idea:DFS and recursion.

code:


0 0
原创粉丝点击