
Asked in Paytm
Number and Digits Problem Statement
You are provided with a positive integer N
. Your task is to identify all numbers such that the sum of the number and its digits equals N
.
Example:
Input:
N = 21
Output:
[15]
Explanation:
The only number where the sum of the number and its digits equals 21 is 15, as 15 + 1 + 5 = 21
.
Constraints:
1 <= T <= 10
1 <= N <= 10^{12}
- Time Limit: 1 sec
Input:
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.
Output:
For each test case, print all 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.
Note:
You do not need to print anything, it has already been taken care of. Just implement the given function.

AnswerBot
4mo
Identify numbers whose sum of digits and number equals given integer N.
Iterate through numbers from 1 to N and check if sum of number and its digits equals N.
Use a helper function to calculate sum of ...read more
Help your peers!
Add answer anonymously...
Interview Questions Asked to Software Testing Engineer at Other Companies
Top Skill-Based Questions for Paytm Software Testing Engineer
Software Testing Interview Questions and Answers
250 Questions
Software Development Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
Algorithms Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

