Hey guys im trying to generate all possible string for a given pattern given a length and length of blocks.
For example if length=5 and the code was 2,1 then there must a block of 2 and then a block of 1 with at at least one gap between them. 'X' is a gap and 'Y' is a block
Here is what my program gives me:
So the way i do it right now is using binary strings from 00000 to 11111 and then prune off the ones that don't meet the code criteria. The problem is it has to work for lengths upto 30 and more complicated codes like 1,3,1,5,3 at this point the pruning gets a bit much anyone have a better method to generate the output?