6 lines java solution with O(n) runtime
\n    public String reverseStr(String s, int k) {\n        StringBuilder res = new StringBuilder();\n        for (int i = 0; i < s.length(); i++) {\n           
```\n    public String reverseStr(String s, int k) {\n        StringBuilder res = new StringBuilder();\n        for (int i = 0; i < s.length(); i++) {\n            if (i % (2 * k) < k) res.insert(i - i % (2 * k), s.charAt(i));\n            else res.append(s.charAt(i));\n        }\n        return res.toString();\n    }\n```
[]