【leetcode】重复的子字符串

 

bool repeatedSubstringPattern(char* s) {
    int n = strlen(s);
    char k[2 * 10000 + 1];
    k[0] = 0;
    strcat(k, s);
    strcat(k, s);
    return strstr(k + 1, s) - k != n;
}

 

posted @ 2020-09-08 11:57  温暖了寂寞  阅读(93)  评论(0编辑  收藏  举报