Reverse String II

2017/12/9 posted in  leetcode

运用内置的reverse函数

class Solution {
public:
    string reverseStr(string s, int k) {
        for (int i = 0; i<s.length(); i+=2*k) {
            reverse(s.begin()+i, min(s.begin()+i+k, s.end()));
        }
        return s;
    }
};