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
Post a Comment