Reverse String II easy c++ solution c++ with 100% beats 🔥🔥🔥
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    void reverse(string &s,int l,int r){\n        for(size_t i=l,j=r;i<j;i++,j--){\n            swap(s[i],s[j]);\n        }\n    } \n    string reverseStr(string s, int k) {\n        bool flag=true;\n        for(int i=0;i<s.size();i+=k) {\n           if(flag) {\n               if(i+k-1 >= s.size()) reverse(s,i,s.size()-1);\n               else reverse(s,i,i+k-1);\n               flag=false;\n           }\n           else flag=true;\n        }\n        return s;\n    }\n};\n```
['C++']