Closed congr closed 5 years ago
class Solution {
public boolean repeatedSubstringPattern(String s) {
// if (s.length() % 2 == 1) return false; // abaabaaba len :9
String t = s + s;
return t.substring(1, t.length()-1).contains(s);
}
}
https://leetcode.com/problems/repeated-substring-pattern/