C++ || 12 ms Solution || Easy to understand
Runtime: 12 ms, faster than 95.60% of C++ online submissions for Reverse String II.\nMemory Usage: 7.2 MB, less than 95.83% of C++ online submissions for Revers
***Runtime: 12 ms, faster than 95.60% of C++ online submissions for Reverse String II.\nMemory Usage: 7.2 MB, less than 95.83% of C++ online submissions for Reverse String II.***\n```\nclass Solution {\npublic:\n    string reverseStr(string s, int k) {\n        int index = 0;\n        while(index < s.size()){\n            reverse(s.begin()+index, s.begin()+index+k > s.end() ? s.end() : s.begin()+index+k);\n            index += 2*k;\n        }\n        return s;\n    }\n};\n```
['C', 'C++']