Sample 5lines JAVA solutions


  • 0
    T
    public class Solution {
        public boolean repeatedSubstringPattern(String s) {
            if(s.length() <=1) return false;
            String s2 = s+s;
            s2 = s2.substring(1,s2.length()-1);
            if(!s2.contains(s)) return false;
            return true;
        }
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.