30:00
Given a string s, check whether it can be built by taking one of its substrings and appending copies of it together (at least two copies in total).
s
1≤s.length≤1041 \leq s.\text{length} \leq 10^41≤s.length≤104
s consists of lowercase English letters.
Run code to see results.
s = "abab" (n = 4)
s + s ; s slides along it, one shift per step
0
1
2
3
4
5
6
7
If s is some block repeated, rotating s by one block length gives s back. Rotations of s are exactly the length-4 windows of s + s.
Decide whether s is some shorter block written two or more times in a row. "abab" is "ab" twice, so the answer is true; "aba" cannot be built that way.