Number And Digits You are given a positive number ‘N.’ You need to find all the numbers such that the sum of digits of those numbers to the number itself is equal to ‘N.’ For example: 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 ...

read more
CodingNinjas
author
2y
To solve this problem our program should give the output after addition of all the digits of a given number.For ie. if someone has given input of 163 then our program should give 10 as a output....
see more
CodingNinjas
author
2y
Brute ForceIn 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 equa...
see more
CodingNinjas
author
2y
Optimised ApproachThe 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 traver...
see more
Add answer anonymously...
Virtusa Consulting Services Associate Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2023 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter