C++ two approaches || commented
Approach 1:\n\nstring getSmallestString(int n, int k) {\n\tstring res;\n\tint c;\n\tfor(int i=0;i<n;i++){\n\t\t//start with \'a\'\n\t\tc=1;\n\t\t//If current in
**Approach 1:**\n```\nstring getSmallestString(int n, int k) {\n\tstring res;\n\tint c;\n\tfor(int i=0;i<n;i++){\n\t\t//start with \'a\'\n\t\tc=1;\n\t\t//If current index holds \'a\' then remaining n-i-1 length should be enough to hold atleast \'z\' in every index\n\t\t//if it is not enough we make the current char b,c,d till the above condition satisfies\n\t\twhile((n-i-1)*26<(k-c)) c++;\n\t\tres.push_back(\'a\'+c-1);\n\t\tk=k-c;\n\t}\n\treturn res;\n}\n```\n\n**Approach 2 (EFFICIENT):**\n```\nstring getSmallestString(int n, int k) {\n\t//start with all a\'s\n\tstring res(n,\'a\');\n\t//reduce k by n as we used 1(a) for every index\n\tk=k-n;\n\t//lexicographically smaller string ===> insert the highest possible char at the end \n\twhile(k>0){\n\t\t//find the min(k,25) to find the lexicographically large characters possible based on k\n\t\t//if k>25 we make the char z and reduce the k by 25\n\t\tres[--n]+=min(k,25);\n\t\tk=k-min(k,25);\n\t}\n\treturn res;\n}\n```\n\n**Please Upvote : )**
['C']