I am able to pass test cases 1, 2 and 4 but having problem with test case number 3. Also I have a doubt. Can there be a possibiity when the fisrt input is false. In that case there should not be any node present, right; i wrote another code considering this also but even this does not seen to work.
Code consifering first input is never “false” : https://ide.codingblocks.com/s/107298
Considering that first input might be “false” :
