Passing IsBinarySearchTree but doesn't seem right

(post deleted by author)

You’re right. There should be more test cases in place. Regardless of whether there will be an update to the tests I would encourage you to look over some of the logic written here. It looks as if your else if statements are comparingnode.right and node.left (which are objects) to the current node’s value which is an integer.

Also, final return statement will execute in the following ways

different ways return statement will execute
checkLeft(node) || true

// checkLeft returns true
 true || true -> true

// checkLeft returns false
false || true -> true

// checkLeft returns undefined
undefined || true -> true
1 Like

(post deleted by author)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.