题目: 题解:
void swap(char* a, char* b) {char tmp *a;*a *b, *b tmp;
}void reverse(char* l, char* r) {while (l < r) {swap(l, --r);}
}int min(int a, int b) {return a < b ? a : b;
}char* reverseStr(char* s, int k) {int n strl…
题目: 题解:
class Solution:def reverseStr(self, s: str, k: int) -> str:t list(s)for i in range(0, len(t), 2 * k):t[i: i k] reversed(t[i: i k])return "".join(t)