Hi,
Wondering if you can help me here. Given a string length "m" how do
you insert 3 hyphens in differing positions such that the following
conditions are met:
a. all positions are covered
b. no pattern is repeated.
For example, for a string like: ABCDEF
the solutions would be:
A-B-CDE-F
A-B-CD-EF
A-B-C-DEF
A-BCD-E-F
AB-CD-E-F
ABC-D-E-F
A-BC-DE-F
AB-C-DE-F
A-BC-D-EF
AB-C-D-EF
I'm nearly sure I have them all. My questions is are there any "nice"
ways of generating these patterns for any length of string longer than
4 characters.
Any comments/suggestions/code-samples much appreciated.
Thanks,
Al.
Wondering if you can help me here. Given a string length "m" how do
you insert 3 hyphens in differing positions such that the following
conditions are met:
a. all positions are covered
b. no pattern is repeated.
For example, for a string like: ABCDEF
the solutions would be:
A-B-CDE-F
A-B-CD-EF
A-B-C-DEF
A-BCD-E-F
AB-CD-E-F
ABC-D-E-F
A-BC-DE-F
AB-C-DE-F
A-BC-D-EF
AB-C-D-EF
I'm nearly sure I have them all. My questions is are there any "nice"
ways of generating these patterns for any length of string longer than
4 characters.
Any comments/suggestions/code-samples much appreciated.
Thanks,
Al.
Comment