Java, O(n)
\n\nclass Solution {\n\tpublic String getSmallestString(int n, int k) {\n\t// create a char array with length of n\n\t\tchar[] arr = new char[n];\n\t\t// imagin
\n```\nclass Solution {\n\tpublic String getSmallestString(int n, int k) {\n\t// create a char array with length of n\n\t\tchar[] arr = new char[n];\n\t\t// imagine arr is filled with \'a\', \'a\' value is 1, so subtract n from k\n        k -= n;\n\t\tfor(int i = n-1; i >= 0; i--) {\n\t\t\tint cur = Math.min(k, 25);\n\t\t\t// update arr[i] with the value\n\t\t\tarr[i] = (char) (\'a\'+ cur);\n\t\t\tk -= cur;\n\t\t}\n        \t\t\n\t\treturn new String(arr);\n\t}\n} \n```
[]