【leetcode】字符串轮转

 

//如果s2 是s1的子串, 那么s2 必然在s1+s1里面
bool isFlipedString(char* s1, char* s2){
    if (strlen(s1) != strlen(s2))return false;
    char* arr = (char*)calloc(sizeof(char),strlen(s1) * 2 + 1);
    strcat(strcat(arr,s1),s1);
    if (strstr(arr, s2))return true;    
    return false;
}

 

posted @ 2020-09-04 13:16  温暖了寂寞  阅读(180)  评论(0编辑  收藏  举报