Your Input: 13 100 98 102 96 99 -1 -1 -1 97 -1 -1 -1 -1

97

Expected output is 98 96 99

For the above input, why it is giving three integers in the output? Actually, it is happening for every input test.

Your Input: 13 100 98 102 96 99 -1 -1 -1 97 -1 -1 -1 -1

97

Expected output is 98 96 99

For the above input, why it is giving three integers in the output? Actually, it is happening for every input test.

It seems to be thisâ€¦ The first number is the value of the answer node, the next number is the value of the left child of answer, and the third number is the value of the right child of answer. Makes sense because a node would have three fields.