easy go solution


  • 0
    H
    func repeatedSubstringPattern(s string) bool {
    outloop:
        for i := 1; i <= len(s)/2; i++ {
            if len(s)%i == 0 {
                for j := 0; j < len(s); j++ {
                    if s[j] != s[(j+i)%len(s)] {
                        continue outloop
                    }
                }
    
                return true
            }
        }
    
        return false
    }
    

Log in to reply
 

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