I am getting WA on Test case 6. I am unable to figure out what case I am missing. Could someone please suggest some corner cases so I could test my code and understand?
On my local computer your code outputs ‘yes’ for this input, but correct answer is ‘no’.
2
2 1
2 1
1 2
Also g++ prints some undefined behavior warnings:
treeord.cpp:51:5: warning: ‘rootindex’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if(nextindex>rootindex)
^~
treeord.cpp:38:5: warning: ‘nextindex’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if(nextindex<rootindex)