Permutation and Combination Problem-word arrangement

181 Views Asked by At

There are three pieces of paper.In the three papers ,a string (non-empty) has to be written such that none of the string on any paper is prefix of some other string.Also alphabet size of characters in the string is equal to first K English Alphabets. (i.e. 1 ≤ K ≤ 26). In how many ways can we select three non empty strings of length less than or equal to N. Example:

N=1 K=2: There is no valid arrangement of three strings to the watches, because at least one of the string will be equal to other which will violate the property stated in the problem.

N=1 K=3: There are 6 possible arrangements. {"a", "b", "c"} {"a", "c", "b"} {"b", "a", "c"} {"b", "c", "a"} {"c", "a", "b"} {"c", "b", "a"}

N=2 K=2: 36

Can we obtain generalized result of the above question?