Want to solve this problem? Login now to get access to solve the problems

Problem

Submissions

Solution

Leaderboard

Coming soon

16

Difficulty: EASY

Avg. time to solve

15 min

Success Rate

85%

Problem Statement

Suggest Edit

```
1. The difference between ‘9’ and ‘0’ is not considered as 1.
2. All single digit numbers are considered as Jumping Numbers.
```

```
The first line contains an integer 'T' denoting the number of test cases.
The only line of each test case contains an integer N.
```

```
For each test case, print all the Jumping Numbers smaller than or equal to N in ascending order.
```

```
You do not need to print anything, it has already been taken care of. Just implement the given function.
```

```
1 <= T <= 100
1 <= N <= 10^8
Time Limit: 1 sec
```

```
1
20
```

```
0 1 2 3 4 5 6 7 8 9 10 12
```

```
These are all the jumping numbers from 0 to 12 as all the single digit numbers are jumping numbers and out of the two digit numbers only 10 and 12 are the jumping numbers less than 20 as the absolute difference in the adjacent digits of 10 and 12 is 1.
```

```
2
1
30
```

```
0 1
0 1 2 3 4 5 6 7 8 9 10 12 21 23
```

```
These are all the jumping numbers from 0 to 1.
These are all the jumping numbers from 0 to 30, as all the single digit numbers are jumping numbers and out of the two digit numbers only 10,12,21,23 are jumping numbers. 23 is a jumping number because the absolute difference of 2 and 3 is 1, 21 is a jumping number because the absolute difference of 2 and 1 is 1.
```

Want to solve this problem? Login now to get access to solve the problems