Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
1 |
|
思路:两个节点必然位于公共结点的左右两边。
采用递归。
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
1 |
|
思路:两个节点必然位于公共结点的左右两边。
采用递归。
近期评论