FastPrepFastPrep
Problem Brief

Come Looking for the Smallest Num Which Must Be > Than a Specific Num. πŸ”Ž

FULLTIMEOA

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 πŸ˜‰.

1Example 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.

2Example 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)

3Example 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

Limits and guarantees your solution can rely on.

  • 1 <= Z <= 500.
  • public int gmsFindTheTinestGreaterThanANum(int Z) {
        // write your code here
    }
    
    Input

    N

    10

    Output

    11

    Sign in to submit your solution.