JAVA | Two-Pointers | Easy
Please Upvote !!! (\u25E0\u203F\u25E0)\n\nclass Solution {\n    public String reverseStr(String s, int k) {\n        char[] chars = s.toCharArray();\n        \n
### Please Upvote !!! **(\u25E0\u203F\u25E0)**\n```\nclass Solution {\n    public String reverseStr(String s, int k) {\n        char[] chars = s.toCharArray();\n        \n        for (int i = 0; i < s.length() - 1; i += 2 * k) {\n            int start = i;\n            int end = Math.min(i + k - 1, s.length() - 1);\n            \n            while (start < end) {\n                char temp = chars[start];\n                chars[start++] = chars[end];\n                chars[end--] = temp;\n            }\n        }\n        \n        return new String(chars);\n    }\n}\n\n// TC: O(n), SC: O(n)\n```
['Two Pointers', 'Java']