Four lines java


  • 0
    A

    public class Solution {
    public boolean repeatedSubstringPattern(String str) {
    if(str == null || str.length() == 0)
    return false;
    int pos = (str+str).indexOf(str, 1);
    return pos != -1 && pos < str.length();
    }
    }


Log in to reply
 

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