ByteByteGo logo
menuProblems List

Phone Keypad Combinations

Medium

You are given a string containing digits from 2 to 9 inclusive. Each digit maps to a set of letters as on a traditional phone keypad:

1empty

2abc

3def

4ghi

5jkl

6mno

7pqrs

8tuv

9wxyz

Return all possible letter combinations the input digits could represent.

Example:

Input: digits = '69'
Output: ['mw', 'mx', 'my', 'mz', 'nw', 'nx', 'ny', 'nz', 'ow', 'ox', 'oy', 'oz']

You can practice coding exercises online by logging into bytebytego.com on your laptop.