Simple java solution with explaination| o(n) time,o(n) space
we want String of length n and lexographic shortest string as possible.\n2. so take an character array of size n and initialize every index value with \'a\'. an
1. we want String of length n and lexographic shortest string as possible.\n2. so take an character array of size n and initialize every index value with \'a\'. and decrement k.\n3. by doing above step if k reaches 0 it means it is the desired answer. why? becuase all a together are enough to make k sum. \n4. run repeat below steps till k>0. (k>0 indicates we need to increase some characters values from \'a\' to any value till \'z\').\n5.  since we want lexographic min String we will try to increase character from backward directions. and try to satisfy sum=k or in our case k=0.\n6.  check Min(25,k) as it is max by which we can increase. i.e. \'a\'+25 = 26 and if k is already less then 25 it means we can just increase a by k and we will have desired sum.\n7.  now decrement k with Min(25,k). and repeat the process.\n8.  once k reaches 0 we have reached desired sum.\n\ntime complexity is o(n)\n```\nclass Solution {\n    public String getSmallestString(int n, int k) {\n        char[] ch = new char[n];\n        for(int i=0;i<n;i++) {\n            ch[i]=\'a\';\n            k--;\n        }\n        int currChar=0;\n        while(k>0) {\n            currChar=Math.min(25,k);\n            ch[--n]+=currChar;\n            k-=currChar;\n        }\n        return String.valueOf(ch);\n    }\n}\n```
['Greedy', 'Java']