java
If you like it pls upvote\n\n\n    public String reverseStr(String s, int k) {\n        StringBuilder res = new StringBuilder();\n        StringBuilder temp = n
If you like it pls upvote\n```\n\n    public String reverseStr(String s, int k) {\n        StringBuilder res = new StringBuilder();\n        StringBuilder temp = new StringBuilder();\n        int count = 0;\n        int cnt = 0;\n        for (int i = 0; i < s.length(); i++) {\n            if (count < k) {\n                temp.append(s.charAt(i));\n                count++;\n            } else if (count == k) {\n                temp.reverse();\n                res.append(temp);\n                temp.setLength(0);\n                count = k+1;\n                i--;\n            } else {\n                if (cnt < k) {\n                    res.append(s.charAt(i));\n                    cnt++;\n                } else {\n                    count = 0;\n                    cnt = 0;\n                    i--;\n                }\n            }\n        }\n        if (cnt==0) temp.reverse();\n        return res.toString() + temp;\n    }\n\n```
['Java']