38.重复的子字符串
方法1:
class Solution {public boolean repeatedSubstringPattern(String s) {if (s.equals("")) return false;String s2=(s+s).substring(1,(s+s).length()-1);//去掉首尾字符return s2.contains(s);//判断是否包含s}
}
class Solution(object):def repeatedSubstringPattern(self, s):if (s==""):return false;s2=(s+s)[1:-1]#去掉首尾字符return s2.find(s)!=-1#判断是否包含s
方法二:
代码随想录