Simple Greedy Approach with explanation
\n# Approach\n Describe your approach to solving the problem. \nGreedy\n# Complexity\n- Time complexity:O(n)\n Add your time complexity here, e.g. O(n) \n\n- Sp
\n# Approach\n<!-- Describe your approach to solving the problem. -->\nGreedy\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nfunc getSmallestString(s string, k int) string {\n    newStringWithKDiff := ""\n    for i := 0; i < len(s); i++{\n        if s[i] == \'a\'{\n            newStringWithKDiff += string(s[i])\n            continue\n        }\n        // first we need know distances between current char and\n        // \'a\' why? to make smallest string it should move\n        // to \'a\' or to up in aphabetically\n        // so if possible replace it with \'a\' not replace it \n        // with one that is aphabetically small like \n        // \'a\' not possible next best char is \'b\' then \'c\'\n        // logic of problem is like that i hope you understood\n        // any question feel free to comment\n        distanceToZ := 123 - int(s[i])\n        distanceToA := int(s[i]) - 97\n        if distanceToZ > distanceToA && k >= distanceToA{\n            k -= distanceToA\n            newStringWithKDiff += "a"\n        }else if distanceToZ < distanceToA && k >= distanceToZ{\n            k -= distanceToZ\n            newStringWithKDiff += "a"\n        }else if distanceToZ == distanceToA && k >= distanceToZ{\n            k -= distanceToZ\n            newStringWithKDiff += "a"\n        }else if k > 0{\n            newStringWithKDiff += string(int(s[i]) - k)\n            k = 0\n        }else{\n            newStringWithKDiff += string(s[i])\n        }\n    }\n    return newStringWithKDiff\n}\n```
['String', 'Greedy', 'Go']