We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
因为节点没有指向父节点的指针,所以先使用前序遍历遍历二叉树,保存从根节点到两个节点的两条路径
然后问题转化成找出两条路径最后一个相同的节点