SIMPLE ONE PASS SOLUTION
Complexity
Time complexity: O(n)
Code
# Complexity
- Time complexity: O(n)

# Code
```cpp []
class Solution {
public:
    string getSmallestString(string s, int k) {
        int n = s.size();
        for(auto &i: s){
            int back = i - 'a';
            int front = ('a' - i + 26) % 26;

            if(front <= back && front <= k){
                k -= front;
                i = 'a';
            }
            else{
                int maxBack = min(back, k);
                i = (i - 'a' - maxBack) + 'a';
                k -= maxBack;
            }
        }
        return s;
    }
};
```
['C++']