String period in linear time

30 views Asked by At

Do you know how to find the fractional period of a string in linear time? Some examples of what I am asking for: input "cbcbcb" output 2

input "qwertyd" output 7

input "fghfghf" output 3

I have tried to solve this problem but I can't obtain a 0(n) complexity, (n is the length of the string)

0

There are 0 answers