Interview Program

Print all jumping numbers smaller than or equal to x.

Input: x = 105
Output: 0 1 2 3 4 5 6 7 8 9 10 12 21 23 32 34 43 45 54 56 65 67 76 78 87 89 98 101

Note: A number is called as a jumping number if all adjacent digits in it differ by 1. The difference between ‘9’ and ‘0’ is not considered as 1.





Thanks and Regards,
Solution provided by Nilmani Prashanth

Leave a Reply

Your email address will not be published. Required fields are marked *