[c++] easy with example
My idea behind this code to take character gridily \nmeans first i try to pick 26 if possible \n\nNow the question is how to check if possible \nSo here is answ
My idea behind this code to take character gridily \nmeans first i try to pick 26 if possible \n\nNow the question is how to check if possible \nSo here is answer like if we pick 26 and the remaining value is geater then required number of element then it safe to pick 26 thats it\n\nok now see example \n```\nlet think n=5 and k=73  and e=0 (e repesent number of element currently picked)\npick 26 means \'z\'          condition 73-26>n-e-1 // n=5 and we pick 26 out of 76 and its safe\n\n73-26=47\nnow again pick 26       condition 47-26>n-e-1 //n=5 and e=1 as we pick z priviously\n\n47-26=21       \nnow we are not able to pick 26,25,24,22,21 and same way the consicutive value \nbut we can pick 19 ans 21-19 =2 and after that we can pick two consicutive \'a\'\n\nso at last reverse your answer as we have to find minimum\n```\n\n```\nclass Solution {\npublic:\n    string getSmallestString(int n, int k) {\n        int a=26;\n        int e=0;\n        string ans="";\n        for(int i=0;i<n;)\n        {\n            if(k-a>=n-e-1)\n            {\n                k-=a;\n                ans+=(\'a\'+(a-1));\n                i++;\n                e++;\n            }\n            else\n            {\n                a-=1;\n            }\n        }\n        reverse(ans.begin(),ans.end());\n        return ans;\n    }\n};\n```\n\n**please up vote if you have query comment down bellow**
[]