3723. Maximize Sum of Squares of Digits
You are given two positive integers
numandsum.A positive integer
nis good if it satisfies both of the following:
- The number of digits in
nis exactlynum.- The sum of digits in
nis exactlysum.The score of a good integer
nis the sum of the squares of digits inn.Return a string denoting the good integer
nthat achieves the maximum score. If there are multiple possible integers, return the maximum one. If no such integer exists, return an empty string.
1 | class Solution { |