4ms C ,easy understand
\nvoid reverse(int start,int end,char *s)\n{\n    char tmp;\n    while(start < end)\n    {\n        tmp = s[end];\n        s[end--] = s[start];\n        s[start
```\nvoid reverse(int start,int end,char *s)\n{\n    char tmp;\n    while(start < end)\n    {\n        tmp = s[end];\n        s[end--] = s[start];\n        s[start++] = tmp;\n    }\n}\n\nchar* reverseStr(char* s, int k) \n{\n    /*cal len of s*/\n    int len = strlen(s);\n    /*len less than k*/\n    if(len <= k)\n    {\n        reverse(0,len - 1,s);\n        return s;\n    }\n        \n    for (int i = 0; i < len; i += 2 * k) \n    {   /*at least 2k left*/\n        if(i + 2*k <=len)\n        {\n            reverse(i,i + k - 1,s);\n        }\n        /*more than or equal to k left*/\n        else if(len - i >= k)\n        {\n            reverse(i,i + k - 1,s);\n            break;\n        }\n        /*less than k,reverse i to len-1*/\n        else if(len - i < k)\n        {\n            reverse(i,len - 1,s);\n            break;\n        }\n    }  \n    \n    return s;\n    \n}\n```
[]