100% beats | simple approach
Approach\nJust check how small the current character can be made.\nIt can be made \'a\' in every step except at the last step where it may or may not be made \'
# Approach\nJust check how small the current character can be made.\nIt can be made \'a\' in every step except at the last step where it may or may not be made \'a\' and then you run out of k operations\n\n# Complexity\n- Time complexity: O(n)\n\n# Code\n```\nclass Solution {\npublic:\n    string getSmallestString(string s, int k) {\n        string ans = s;\n        for (int i = 0; i < s.size(); i++){\n            if (k == 0) break;\n            int z = min(int(s[i]-\'a\'),26-int(s[i]-\'a\'));\n            if (k >= z){\n                ans[i] = \'a\';\n                k -= z;\n            } else {\n                ans[i] -= k;\n                break;\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']