EASY beat 100% JAVA C++
Intuition\nput a as times as possible.\n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time complexity:\nO(N)\n\n- Space comp
# Intuition\nput a as times as possible.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\n    public int dist(char ch){\n        return Math.min(26-Math.abs(ch-\'a\'),Math.abs(\'a\'-ch));\n    }\n    public String getSmallestString(String s, int k) {\n        StringBuilder sb=new StringBuilder();\n        for(int i=0;i<s.length();i++){\n            if(dist(s.charAt(i))<=k){\n                sb.append(\'a\');\n                k-=dist(s.charAt(i));\n            }\n            else if(k>0){\n                sb.append(((char)(s.charAt(i)-k)));\n                k=0;\n            }\n            else{\n                sb.append(s.charAt(i));\n            }\n        }\n        return sb.toString();\n    }\n}\n```
['Greedy', 'C++', 'Java', 'Python3']