Wednesday, August 3, 2011

Given a set of letters and a length N, produce all possible output.(Not permutation).

For example, give the letter (p,o) and length of 3, produce the following output(in any order you want, not just my example order)

ppp ppo poo pop opp opo oop ooo

another example would be given (a,b) and length 2

answer: ab aa bb ba

No comments :