Program has for input 1 or more periods of both sequences. How to test whether these sequences are the same with the least number of comparisons.
What's the best way to do it?
Program has for input 1 or more periods of both sequences. How to test whether these sequences are the same with the least number of comparisons.
What's the best way to do it?
Find the smallest period of the two input strings, see for example this question and this question which describe a solution using the Knuth-Morris-Pratt algorithm. Once you've found the strings' smallest periods then it's trivial to compare them.