Computer Science, asked by anupamajp03, 4 months ago

CONSTRAINTS:
1 <= (startState| = |finalState) = \deadlock[D[ <= 5
1 <= n <= 50000
All the strings contain digits from 0 to 9.
SAMPLE INPUT #1:
123
313
3
113
213
413
11:
SAMPLE OUTPUT #1:
3
SAMPLE EXPLANATION #1:
startState = "123"
endState = "313"
n = 3
deadlock = ["113", "213", "413"]
We require 3 seconds to break the lock. The sequence
of moves will be "123" -> "223" -> "323" -> "313".
Therefore, the answer is 3.​

Answers

Answered by yadavsv09
1

Answer:

Input : n = 20

d = 5

Output : 5 15

Input : n = 50

d = 2

Output : 2 12 20 21 22 23 24 25 26 27 28 29 32 42

Approach 1:

Take a loop from 0 to n and check each number one by one, if the number contains digit d then print it otherwise increase the number. Continue this process until loop ended.

Explanation:

Similar questions