Simple java solution
Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(1)\n\n# Code\n\nclass Solution {\n    public String getSmallestString(String s, int k) {\n        S
# Complexity\n- Time complexity: $$O(n)$$\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\nclass Solution {\n    public String getSmallestString(String s, int k) {\n        StringBuilder nm=new StringBuilder();\n        for(int i=0;i<s.length();i++)\n            {\n                char c=s.charAt(i);\n                int val=Math.min(123-c, c-97);\n                if(k>0)\n                {\n                    if(val<=k)\n                    {\n                        nm.append("a");\n                        k-=val;\n                    }\n                    else\n                    {\n                        c=(char)(c-k);\n                        nm.append(c);\n                        k-=val;\n                    }\n                }\n                else\n                {\n                    nm.append(c);\n                }\n            }\n        return nm.toString();\n    }\n}\n```
['Java']