跳至主要內容

在二叉树中找到两个节点的最近公共祖先

微信公众号:储凡Less than 1 minute

在二叉树中找到两个节点的最近公共祖先

题目链接

题目描述

刷题思路

代码实现

function TreeNode(x) {
  this.val = x
  this.left = null
  this.right = null
}

/**
 *
 * @param root TreeNode类
 * @param o1 int整型
 * @param o2 int整型
 * @return int整型
 */
function lowestCommonAncestorFromNode(root, o1, o2) {
}

一些建议