- 博客(1)
- 收藏
- 关注
原创 【二叉树】最近公共祖先Lowest Common Ancestor of a Binary Tree
题目:求二叉树上两点的最近公共祖先 TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) { if (!root || root == p || root == q) return root; TreeNode* left = lowestCommonAncestor(root->
2017-06-06 10:30:27 289
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人