# String Return Value - ------ ------------- 0 "bobo" "not square-free": The whole string is a square string. 1 "apple" "not square-free": Substring "pp" is a square string. 2 "pen" "square-free": No square substrings. 3 "aydyamrbnauhftmphyrooyq" "not square-free" 4 "qwertyuiopasdfghjklzxcvbnm" "square-free"
Starting position | Length of first half | First half | Second half |
0 | 1 | "a" | "b" |
0 | 2 | "ab" | "cd" |
0 | 3 | "abc" | "def" |
0 | 4 | "abcd" | Not big enough: Next starting position |
1 | 1 | "b" | "c" |
1 | 2 | "bc" | "de" |
1 | 3 | "bcd" | "efg" |
1 | 4 | "bcde" | Not big enough: Next starting position |
2 | 1 | "c" | "d" |
2 | 2 | "cd" | "ef" |
2 | 3 | "cde" | Not big enough: Next starting position |
3 | 1 | "d" | "e" |
3 | 2 | "de" | "fg" |
3 | 3 | "def" | Not big enough: Next starting position |
4 | 1 | "e" | "f" |
4 | 2 | "ef" | Not big enough: Next starting position |
5 | 1 | "f" | "g" |
5 | 2 | "fg" | Not big enough: Next starting position |
6 | 1 | "g" | Not big enough: Next starting position |
7 = End of string - return "square-free" |
Starting position | Size of string | String | First half equals second half? |
0 | 2 | "ab" | No. |
0 | 4 | "abcd" | No. |
0 | 6 | "abcded" | No. |
1 | 2 | "bc" | No. |
1 | 4 | "bcde" | No. |
1 | 6 | "bcdede" | No. |
2 | 2 | "cd" | No. |
2 | 4 | "cded" | No. |
3 | 2 | "de" | No. |
3 | 4 | "dede" | Yes - return "not square-free" |