Letter Phone

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.

The digit 0 maps to 0 itself.
The digit 1 maps to 1 itself.

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

Make sure the returned strings are lexicographically sorted.

Interview Code Editor
  • Solution Approach
  • Complete Solution
5952 successful submissions.
Asked In:
  • Facebook
  • Epic systems
Click here to jump start your coding interview preparation