The lowest common ancestor (LCA) of any two nodes p and q in a tree, or a directed acyclic graph, is the lowest/deepest node that is the ancestor of p and q (i.e. p and q are the descendants of this node). p and q are both ancestors/descendants of themselves.