Letter Combinations of a Phone Number

Given a string containing digits from 2-9, return all possible letter combinations that the number could represent using a mapping of digits to letters like on a telephone button. Return the answer in any order. Note that 1 does not map to any letters.

Constraints

  • 0 <= digits.length <= 4
  • digits[i] is a digit in the range ['2', '9'].
Saving… · 2 lines
class Solution:
def letterCombinations(self, digits: str) -> List[str]:
Console

Click Run to execute sample tests.