Is This a Binary Search Tree?

  • + 1 comment

    This would return false. Inorder 8 -> 18 -> 10

    18 > 10

    As long as the last element is the last elemented "visited" and not last element passed by.

    • + 1 comment

      Yes, but as long as we return max values from left subtrees and min values from right subtrees and make sure they follow the rule.

      • + 1 comment

        I didn't do that. I just did inorder traversal recursively and made sure it was all ascending order. Passed all cases.

        • + 0 comments

          Mine is also a similar idea.