✅C++ || TC - O(N), SC- O(1)  || 🗓️ Daily LeetCoding Challenge || March || Day 22
Approach: \n1) Since we want to make a string lexicographically smaller so we will make a string of size n with \'a\'.\n2) Start from the right to left characte
**Approach:** \n1) Since we want to make a string lexicographically smaller so we will make a string of size n with \'a\'.\n2) Start from the right to left character, increase the char value by min(25, k) until k will reach to 0.\n\n```\nclass Solution {\npublic:\n    string getSmallestString(int n, int k) {\n        string res(n, \'a\'); \n        k -= n; //a= 1, substract all n* a value\n        \n        int i = res.size()-1;\n        while(k>0){\n            int temp = min(25, k);  //1(a)+25 = z\n            res[i] += temp;  //a = 1+25 = 26 = z\n            k -= temp;\n            i--;\n        }\n        \n        return res;\n    }\n};class Solution {\npublic:\n    string getSmallestString(int n, int k) {\n        string res(n, \'a\'); \n        k -= n; //a= 1, substract all n* a value\n        \n        int i = res.size()-1;\n        while(k>0){\n            int temp = min(25, k);  //1(a)+25 = z\n            res[i] += temp;  //a = 1+25 = 26 = z\n            k -= temp;\n            i--;\n        }\n        \n        return res;\n    }\n};\n```
[]