[C++] Greedy Solution
Intuition\nCyclic distance between two characters = min((b-a+26)%26, (a-b+26)%26)\nIterate through all the characters from left to right. If we have enough K le
# Intuition\nCyclic distance between two characters = `min((b-a+26)%26, (a-b+26)%26)`\nIterate through all the characters from left to right. If we have enough K left to make the character to make the character \'a\', then make it while decreasing k accordingly. Else decrease the character as much as possible with the available K. Than break out of the loop. The resulting string is the answer. \n\n# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\nclass Solution {\n    int dist(char a, char b){\n        return min((a-b+26)%26, (b-a+26)%26);\n    }\npublic:\n    string getSmallestString(string s, int k) {\n        int n=s.length(), i=0;\n        while(k && i<n){\n            if(dist(s[i], \'a\')<=k){\n                k-=dist(s[i], \'a\');\n                s[i]=\'a\';\n            }else{\n                s[i]-=k;\n                break;\n            }\n        i++;}\n        return s;\n    }\n};\n```
['Greedy', 'C++']