Leetcode-236题:Lowest Common Ancestor of a Binary Tree
题目Givenabinarytree,findthelowestcommonancestor(LCA)oftwogivennodesinthetree.思路分别求出跟节点到p,q的路径,那么路径的共同前缀的末尾即为所求。代码#Definitionforabinarytreenode.#classTreeNode(object):#def__init__(self,x):#self.val=x#se