Facebook | Onsite | Generate patterns

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2018-05-24Added By Anonymous
Source: Link

Company: Meta
Role: e3, e4
Interview Stage: Onsite
Location: unknown
Year: unknown

Original Post Content:

Given a string as input, return the list of all the patterns possible:

'1' : ['A', 'B', 'C'],
'2' : ['D', 'E'],
'12' : ['X']
'3' : ['P', 'Q']
Example if input is '123', then output should be
[ADP, ADQ, AEP, AEQ, BDP, BDQ, BEP, BEQ, CDP, CDQ, CEP, CEQ, XP, XQ]

Comments