Description
Solutions
Come Looking for the Smallest Num Which Must Be > Than a Specific Num. π
π₯ FULLTIMEπRELATED PROBLEMS
To solve this problem, you gonna need to write up the func in the editor π
What you've been given: int Z
What your func is gonna do:
1. find the smallest num that is > than Z.
2. total of all the digits of the num you find must == 2 * (total of all digits of Z)
Memo π:
When solving this problem, you can mainly focus on correctness. As for your code performance, it would not be the focus this time π.
Example 1:
Input: N = 10
Output: 11
Explanation:As we can see, 11 is the smallest num that is > 10. What is the total sum of all digits of 10? The ans is 1 + 0 = 1... What is the total sum of all digits of 11? The ans is 1 + 1 = 2... 2 == 1 * 2, so 11 should be returned.
Example 2:
Input: N = 14
Output: 19
Explanation:The total of all the digits of 19 (1 + 9 = 10) == 2 * total of digits of 14 (1 + 4 = 5)
Example 3:
Input: N = 99
Output: 9999
Explanation:The sum of digits of 9999 (9 + 9 + 9 + 9 = 36) == total of digits of 99 (9 + 9 = 18).
Constraints:
1 <= Z <= 500
.

Related Problems
Testcase
Result
Case 1
input:
output: