simple c++ code 99% in speed and 100% in memory
\nclass Solution {\npublic:\n    string reverseStr(string s, int k) {\n        if(k>=s.size()){\n            reverse(s.begin(),s.end());\n            return s;\
```\nclass Solution {\npublic:\n    string reverseStr(string s, int k) {\n        if(k>=s.size()){\n            reverse(s.begin(),s.end());\n            return s;\n        }\n        int j =0;\n        while(j<s.size()){\n            if(j+k<s.size())\n                reverse(s.begin()+j,s.begin()+j+k);\n            else\n                reverse(s.begin()+j,s.end());\n                \n            j+=2*k;\n        }\n        return s;\n        \n    }\n};\n```
['C', 'C++']