class Solution {
public:
string reverseStr(string s, int k) {
int n = s.length();
for(int i = 0;i<n;i += 2*k)
{
reverse(s.begin()+i,s.begin()+min(i+k,n));
}
return s;
}
};
leetcode每日一题第八十一天
最新推荐文章于 2024-11-06 23:21:54 发布