Simple Recursion 🔥🔥
Code\n\nclass Solution {\n    public int findans(char first,char last){\n        int diff1 = first-last;\n        int diff2=last-first;\n        if (diff1 < 0)d
# Code\n```\nclass Solution {\n    public int findans(char first,char last){\n        int diff1 = first-last;\n        int diff2=last-first;\n        if (diff1 < 0)diff1 += 26;\n        if(diff2<0)diff2+=26;\n        return Math.min(diff1,diff2);\n    }\n    public String helper(String s,int k,int ind){\n        if(ind==s.length())return "";\n        if(s.charAt(ind)==\'a\')return \'a\'+helper(s,k,ind+1);\n        for(char i=\'a\';i<=\'z\';i++){\n            char first=i;\n            char last =s.charAt(ind);\n            int diff = findans(first,last);\n            if(k-diff<0)continue;\n            return i+helper(s,k-diff,ind+1);\n        }\n        return "";\n    }\n    public String getSmallestString(String s, int k) {\n        if(k==0)return s;\n        return helper(s,k,0);\n    }\n}\n```
['Java']