LeetCode 334.反转字符串
void reverseString(char* s, int sSize) {
int L=0;
int R=sSize-1;
while(L<=R)
{
char temp=s[L];
s[L]=s[R];
L++;
s[R]=temp;
R--;
}
}
char* reverseStr(char* s, int k) {
int len=strlen(s);
for(int i=0;i<len;i=i+2*k)
{
k=i+k>len?len-i:k;
int slow=i;int fast=i+k-1;
while(slow<fast)
{
char temp=s[slow];
s[slow]=s[fast];
s[fast]=temp;
slow++;
fast--;
}
}
return s;
}