Java | O(n) | Greedy check both direction | Easy with comments
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 {\n    public String getSmallestString(String s, int k) {\n        StringBuilder sb = new StringBuilder(s);\n        for(int i = 0; i < s.length() && k != 0; i++){\n            int c = (int) s.charAt(i) - \'a\';\n            int distanceToA = Math.min(c, 26 - c);      // Check both directions\n            if(distanceToA <= k){\n                sb.setCharAt(i, \'a\');\n                k = k - distanceToA;\n            } else {\n                char next = (char) ((c - k) + \'a\');     // Minimize c to closest to a "Lexicographically Small"\n                sb.setCharAt(i, next);\n                k = 0;\n            }\n        }\n        return sb.toString();\n    }\n}\n```
['Java']