✅ JAVA || 10 LINES || ONE TRAVERSAL || EASY || SIMPLE ||
JAVAEASY CLEAN & READABLE\n\n\n\n* Our main goal is to build a string lexiographically smallest.\n* So the smallest possible string for any n would be full of \
``` ```**JAVA**```  ```**EASY**``` ``` ``` ```**CLEAN & READABLE**``` ```\n\n\n```\n* Our main goal is to build a string lexiographically smallest.\n* So the smallest possible string for any n would be full of \'a\'.\n* Now we have to fuflill another condition that is we want the sum of characters  to be some k.\n* By maintaining the lexiograhically smallest string we have to full fill this condition.\n* So we start from rightmost part.\n* If we have k greater than 25 [\'z\'] we replace it with \'z\' and subtract it with 25 == \'z\'.\n* Else replace it with the required character with k as number.\n* Do this until k > 0.\n```\n```\nclass Solution {\n    public String getSmallestString(int n, int k) {\n        char[] answer = new char[n];\n        Arrays.fill(answer, \'a\');\n        k = k - n;\n        while (n > 0 && k > 0) {\n            int min = Math.min(25, k);\n            answer[--n] = (char) (min + \'a\');\n            k -= min;\n        }\n        return String.valueOf(answer);\n    }\n}\n```\n**UPVOTE IF HELPFUL \uD83D\uDE4F**
['Java']