Simple C++ Solution | Linear Time Complexity with constant space
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    string getSmallestString(string s, int k) {\n    int i=0;\n    while(k>0&&i<s.length()){\n        int t=\'z\'-s[i]+1,p=s[i]-\'a\';\n        int take=min(t,p);\n        if(take<=k){\n            s[i]=\'a\';\n            k=k-take;\n        }\n        else{\n            s[i]=s[i]-k;\n            k=0;\n        }\n        i++;\n    }\n    return s;\n}\n};\n```
['C++']