Letter Combinations of a Phone Number


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.


Solution: 

Not hard. Use recursion or iterative. The following code passes LeetCode Online Large Judge.

2013-05-19: iterative solution. Inefficient due to additional vector operations. Need to be optimized.

Comments

Popular posts from this blog

Maximum Gap

[ITint5] Maximum Subarray for a Circular Array

[CC150] Chapter 4 Trees and Graphs