Loading problem...
You are given a non-empty string s. Your task is to determine whether the string can be constructed by concatenating multiple identical copies of a smaller substring.
In other words, you need to check if there exists a base pattern (a proper substring of s) that, when repeated two or more times consecutively, produces the original string exactly.
A proper substring is any substring that is strictly shorter than the original string itself. The base pattern must appear at least twice in the concatenation to form the complete string.
Return true if such a repeating pattern exists, and false otherwise.
s = "abab"trueThe string "abab" can be formed by repeating the substring "ab" exactly twice. Thus, it follows a cyclic repeating pattern.
s = "aba"falseNo valid substring exists that can be repeated to form "aba". The substring "a" would produce "aaa", "ab" would produce "abab", and no other proper substring works.
s = "abcabcabcabc"trueThe string can be constructed by repeating "abc" four times, or equivalently by repeating "abcabc" twice. Multiple valid base patterns may exist.
Constraints