Facebook | Phone Screen | Letter Combinations of a Phone Number

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2018-03-30Added By Anonymous
Source: Link

Company: Meta (Facebook)
Role: unknown
Interview Stage: Phone Screen
Location: unknown
Year: unknown

Original Post Content:

Variation of https://leetcode.com/problems/letter-combinations-of-a-phone-number
Given a string as input, return the list of all the possible patterns:

{ "1" : ['A', 'B', 'C'],
"2" : ['D', 'E'],
"12" : ['X'],
"3" : ['P', 'Q'] }

Example:

Intput: "123"
Output: ["ADP","ADQ","AEP","AEQ","BDP","BDQ","BEP","BEQ","CDP","CDQ","CEP","CEQ","XP","XQ"]
Comments