Cpp
Complexity\n- Time complexity: O(n*26)\n Add your time complexity here, e.g. O(n) \n\n\n# Code\n\nclass Solution {\npublic:\n    string getSmallestString(string
# Complexity\n- Time complexity: O(n*26)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n\n# Code\n```\nclass Solution {\npublic:\n    string getSmallestString(string s, int ki) {\n        string ans="";\n        for(int i=0;i<s.length();i++){\n            bool flag=true;\n            for(int k=0;k<26;k++){\n              int left=(26-(s[i]-\'a\')+k);\n              int right=(s[i]-\'a\')-k;        \n              if(left<=right && ki>=left){\n                  ki-=left;\n                  ans+=\'a\'+k;\n                  flag=false;\n                  break;\n              }\n              else if(left>right && ki>=right ){      \n                ki-=right;\n                ans+=\'a\'+k;\n                  flag=false;\n                 break;\n             }\n\n            }\n            if(flag==true){\n                ans+=s[i];\n            }\n        }   \n        \n        return ans;\n    }\n};\n```
['C++']