What is wrong in this code it shows same output as the expected one?

Checking your code, till then be patient.

try your code with this test case
INPUT
2
10
14 17 7 18 12 5 4 6 21 24
11 17
10
16 11 15 20 2 22 4 25 17 10
16 25

Expected output is
#Preorder : 14 7 5 4 6 12 17 18 21 24
#Nodes within range are : 12 14 17
#Preorder : 16 11 2 4 10 15 20 17 22 25
#Nodes within range are : 16 17 20 22 25

Your output is
#Preorder : 14 7 5 4 6 12 17 18 21 24
#Nodes within range are : 12 14 17
#Preorder : 16 11 2 4 10 15 20 17 22 25
#Nodes within range are : 17 18 21 24

ps: there’s space between # and P

I did not understand what you want to say. Can you please explain ?

Run this test case first and let me know what output is it showing.

OK, I got it thanks!!

Please mark your doubt as resolved .