Easy and Straightforward Code
Intuition\n Describe your first thoughts on how to solve this problem. \nWe try to assign \'a\' to the starting characters of strings and \'z\' to the last part
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe try to assign \'a\' to the starting characters of strings and \'z\' to the last part of string so that we could possibly get the lexicographical smallest string .\n# Approach\n<!-- Describe your approach to solving the problem. -->\nFirst of all assign characher \'a\' to every string character then we could have to modify k=k-n , as we already assign 1 value . now  iterate from the last and assign z to last characters.\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(N)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(N)\n# Code\n```\nclass Solution {\npublic:\n    string getSmallestString(int n, int k) {\n        k=k-n;\n        string ans="";\n        for(int i=0;i<n;i++){\n            ans+=\'a\';\n        }\n        int j=n-1;\n        while(k>25){\n           ans[j]=\'z\';\n           j--;\n           k=k-25;\n        }\n        char ch=k+\'a\';\n        ans[j]=ch;\n        return ans;\n    }\n};\n```
['Greedy', 'C++']