I was asked on an interview: Given a phone number, say 652-7872, print out all possible permutations of the words that it can spell.
2-ABC,
3-DEF,
4-GHI,
5-JKL,
6-MNO,
7-PQRS,
8-TUV,
9-WXYZ,
0-O
For example, one permutation of 652-7872 is JGAJAPP.
I have seen similar questions answered, however, the solutions either aren't the letter individually OR the letters are random through out the whole string.
This question, I believe, is asking for
For position 0 of the phone number string (652-7872), 6 - the only possible letter options are "MNO"
For position 1 of the phone number string (652-7872), 5 - the only possible letter options are "JKL"
For position 2 of the phone number string (652-7872), 2 - the only possible letter options are "ABC"
A short version of possible outcomes for the first 3 #'s would be:
MJA
MJB
MJC
MKA
MKB
MKC
MLA
MLB
MLC
Would someone tell me how to solve this in C#? And I'd be interested in how long it takes you.