hi, what is the number of strings made of only x, y and z and of length n which do not contain the pattern 'xyz' anywhere in them ?
for the pattern 123 we can use the catalan sequence but what about 'xyz'?
e.g for n = 2 , the number of such strings is 9
thanks.
no, the string is made of only the alphabets X,Y and Z
The string can be of any length (n<=30).
If so how long are the strings?
Yes but the string must not contain the pattern 'XYZ'Can letters be repeated?
a valid such string of length 5 is XXYYZ while an invalid one is XYZZZ.
For the case of strings containing only digits 1,2 and 3 ,the number of them of lenght n which do not contain the pattern '123' can be got by the nth Catalan number, so is there any relationship here in case of strings having X,Y and Z and not containing 'XYZ' pattern?
Thanks