Find the Number which contain the digit d
Submissions: 6789   Accuracy:

25.15%

  Difficulty: Basic   Marks: 1

Given two integer number n and d. The task is to find the number between 0 to n which contain the specific digit d.

Input:
The first line contains an integer T, the number of test cases. For each test case, there are two integer n & d.

Output:
For each test case, the output is the numbers that contain the integer d. Print "-1" if no such number found.

Constraints:
1 <= T <= 100
0 <= n <= 103
0 <= d <= 9

Example:
Input

2
20 5
50 2
Output
5 15
2 12 20 21 22 23 24 25 26 27 28 29 32 42

Explanation:
Testcase 1:For number till 20, 5 appears in 5 itself and 15.

 

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Vanshika
Author: Vanshika_pec


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.