Find LCA in Binary Tree, Find LCA in BST
I wrote finding lca long time ago. Today, I learned this more concise code for finding LCA in Binary Tree. The idea is that if there is no p or q in bottom, return null. Or return p, q or root. public static TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { if (root == p… Read More »