O(n) Better Solution Greedy [Cpp]
\nclass Solution {\npublic:\n    string getSmallestString(int n, int k) \n    {\n        string str(n,\'a\');\n        k=k-n;\n        int ri=n-1;\n        whil
```\nclass Solution {\npublic:\n    string getSmallestString(int n, int k) \n    {\n        string str(n,\'a\');\n        k=k-n;\n        int ri=n-1;\n        while(k>0)\n        {\n            str[ri]=str[ri]+min(25,k);\n            ri--;\n            k=k-25;\n        }\n        return str;\n    }\n};\n```
['Greedy', 'C++']