Given the following problem :
Definition : Let S be a string over alphabet Σ .S\' is the smallest period of S
Definition :
Let S be a string over alphabet Σ .S\' is the smallest period of S
S\'
S
See if this solution works for O(n). I used rotation of strings.
public static int stringPeriod(String s){ String s1= s; String s2= s1; for (int i=1; i
The complete program is available in this github repository