give binary search tree BST find low common ancestor LCA node give node bstaccorde definition LCA Wikipedia the low common ancestor define node p q low node T p q descendant allow node descendant Example 1input root 6280479nullnull35 p 2 q 8output 6explanation the LCA nod 2 8 6example 2input root 6280479nullnull35 p 2 q 4output 2explanation the LCA nod 2 4 2 node descendant accord LCA definitionexample 3input root 21 p 2 q 1output 2 ConstraintsThe number nod tree range 2 105109 Nodeval 109All Nodeval uniquep qp q exist BST