Google | Onsite 2019 | Alphabet Combinations
Anonymous User
1224

Given a map of the alphabet, {1:a, 2:b, 3:c,...,26:z}
and an input of a pattern of numbers as strings, write a function to determine how many different letter combinations you can print.

e.g. Input= '12' would give you
1,2 = a,b
12 = l
So return 2 because there are 2 combinations

'122' would give you
1,2,2 = a,b,b
1,22 = a,v
12,2 = l,b
so return 3

1224 would give you
1,2,2,4 = a,b,b,d
12,2,4 = l,b,d
12,24 = l,x
1,2,24 = a,b,x
so return 4

1227 would give you
1,2,2,7 = a,b,b,g
1,22,7 = a,v,g
12,2,7 =l,b,g
so return 3

Case doesn't matter

Comments (1)