DIY: Letter Combinations of a Phone Number

Solve the interview question "Letter Combinations of a Phone Number" in this lesson

Problem statement

Given a string containing digits from 2–9 inclusive, return all the possible letter combinations that the number could represent. Return the answer in any order.

A mapping of digits to letters is given below. Note that 1 does not map to any letters.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.