samedi 8 juin 2019

Sequence (string) consists of repeating another sequence in sliding circular manner

I have have two arrays but will use strings to make the explanation simpler. Need to find out if the first string is a sliding circular repeating or the second string. Examples (pipes are just delimiters, not parts if the strings):

Second string is 'abcd'
'abcd|abcd' - yes
'abcd' - yes
'cd|abcd|ab' - yes
'cd|ab' - yes
'ab' - yes
'сd' - yes

Aucun commentaire:

Enregistrer un commentaire