diff --git a/bst.html b/bst.html index a216086..d038e5a 100644 --- a/bst.html +++ b/bst.html @@ -316,7 +316,7 @@

Make this code better

if(n1 < val && n2<val){ return commonAncestor(node.left, n1, n2); } - if(n1<val && n2<val){ + if(n1>val && n2>val){ return commonAncestor(node.right, n1, n2); } console.log('lowest common ancestor value: ', val);