Facebook | Phone screen | Decode ways

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2017-07-31Added By Anonymous
Source: Link

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

Original Post Content:

If a=1, b=2, c=3,....z=26. Given a string, find all possible codes that string can generate. Give a count as well as print the strings.

For example:
Input: "1123". You need to general all valid alphabet codes from this string.

Output List
aabc //a = 1, a = 1, b = 2, c = 3
kbc // since k is 11, b = 2, c= 3
alc // a = 1, l = 12, c = 3
aaw // a= 1, a =1, w= 23
kw // k = 11, w = 23

https://leetcode.com/problems/decode-ways
Comments