You are given two positive integers num and sum. A positive integer n is good if:
It has exactly num digits (no leading zero).
The sum of its digits is exactly sum.
The score of n is the sum of the squares of its digits.
Return the string of the good integer that maximizes the score. If multiple solutions achieve the same score, return the lexicographically largest one. If no such integer exists, return an empty string "".
Input: num = 3, sum = 20
Output: "992"
Explanation:
Maximize squares by packing 9s: 9+9+2=20 ⇒ "992".
Input: num = 2, sum = 17
Output: 98
Explanation:
Good integers: 89, 98. Both have score 8^2+9^2=145. Lexicographically larger is "98".
Accepted:
Submission: