Wrong test case

  • 0

    the binary tree should hold its property that left subtree.val < root.val and right subtree.val > root val.

    but, when I submit my algorithm, it goes like this:

    Runtime ErrorMore Details 
    Runtime Error Message:	Line 23: ValueError: 2 is not in list
    Last executed input:	[-4,-10,3,-1,7,11,-8,2], [-4,-1,3,-10,11,-8,2,7]

    actually, the test case does not meet the property .

    the postorder is [-4,-1,3,-10,11,-8,2,7] ,so the root is 7.
    so in inorder [-4,-10,3,-1,7,11,-8,2], the value on the left of 7 should be smaller than 7 , the value on the right should be bigger than 7.

    so I think this case is totally wrong.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.