✅ Easiest | | 6 lines Solution | | C++ | | Python ✅
C++\n\nclass Solution {\npublic:\n    string reverseStr(string s, int k) {\n        int l = 0,r = min(k,(int)s.length());\n\n        while(l < s.length()){\n   
# C++\n```\nclass Solution {\npublic:\n    string reverseStr(string s, int k) {\n        int l = 0,r = min(k,(int)s.length());\n\n        while(l < s.length()){\n            reverse(s.begin() + l,s.begin() + r);\n            l += 2 * k;\n            r = min(l + k,(int)s.length());\n        }\n        return s;\n    }\n};\n```\n\n# Pyhton \n\n```\nclass Solution:\n    def reverseStr(self, s: str, k: int) -> str:\n        l, r = 0, min(k, len(s))\n\n        while l < len(s):\n            # Reverse the substring from index l to r\n            s = s[:l] + s[l:r][::-1] + s[r:]\n            \n            # Move to the next pair of substrings\n            l += 2 * k\n            r = min(l + k, len(s))\n\n        return s\n\n```
['String', 'Python', 'C++', 'Python3']