

You are given ‘N’ as 21, the only number whose sum of digits and the number itself equals 21 is 15 as 15 + 1 + 5 = 21. Hence the answer is [15].
The first line contains a single integer ‘T’ representing the number of test cases.
Each test case consists of a single integer ‘N’, which represents the given integer.
For each test case, print all the space-separated integers whose sum of digits with themselves is equal to ‘N’ in increasing order, Print -1 if no such integer exists.
Print a separate line for each test case.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 10^12
Time Limit: 1 sec
In this approach, we iterate through the numbers from 1 to N. We will find the sum of its digits and add it to the integer itself for each number. Then, we check if the obtained sum is equal to N.
We create a recursive function called sumOfDigits(num) that returns the sum of digits of the number num.
Algorithm:
The intuition behind this approach is that any integer’s sum of digits can’t be very high, so we check only 1000 numbers less than and greater than the given number.
So we will traverse from 1 to 1000, and find the number whose sum of digits is with the number itself is equal to the given number.
We create a recursive function called sumOfDigits(num) that returns the sum of digits of the number num.
Algorithm: