plz check the code.https://ide.codingblocks.com/s/191505
Same code but not same output
There were two minor errors: You were not taking input of number of test cases, and while recursively calling left subtree, in place of 0 you need to pass the start variable s.
Corrected Code: https://ide.codingblocks.com/s/191513
Now it works.
Hope it Helps.