 New update is available. Click here to update.

# Stepping Numbers

Posted: 16 Mar, 2021
Difficulty: Moderate

## PROBLEM STATEMENT

#### You should return a list of Stepping Numbers between ‘L’ and ‘R’ (inclusive) in the increasing order.

##### For Example:
``````Consider L = 10, R = 13.
Then, all integers in range [10, 13] are 10, 11, 12, 13.
We can say, that 10 is a stepping number because |1 - 0| = 1.

11 is not a stepping number because |1 - 1| = 0.

12 is a stepping number because |1 - 2| = 1.

13 is not a stepping number because |1 - 3| = 2.

Thus, we should return a list [10, 12].
``````
##### Input format:
``````The first line of input contains an integer ‘T’ denoting the number of test cases. Then, ‘T’ test cases follow.

The first and the only line of each test case consist of two space-separated integers ‘L’ and ‘R’ respectively.
``````
##### Output format :
``````For each test case, if there are ‘K’ stepping numbers between ‘L’ and ‘R’, then print a single line consisting of ‘K’ space-separated integers representing Stepping Numbers between ‘L’ and ‘R’ in increasing order.
``````
##### Note:
``````You do not need to print anything, it has already been taken care of. Just implement the given function.
``````
##### Constraints:
``````1 <= T <= 50
1 <= L <= 10^8
1 <= R <= 10^8
R >= L

Time Limit: 1 second
``````
SIMILAR PROBLEMS

COUNT ISLANDS

Posted: 14 Sep, 2022
Difficulty: Moderate

Capturing Grid

Posted: 14 Sep, 2022
Difficulty: Moderate

Rotting Oranges

Posted: 15 Sep, 2022
Difficulty: Moderate

Distance to a Cycle in Undirected Graph

Posted: 7 Nov, 2022
Difficulty: Moderate

8-Queen Problem

Posted: 19 Dec, 2022
Difficulty: Easy