原文:[LeetCode] Lowest Common Ancestor of a Binary Tree

Lowest Common Ancestor of a Binary Tree Given a binary tree, find the lowest common ancestor LCA of two given nodes in the tree. According to thedefinition of LCA on Wikipedia: The lowest common ances ...

2015-07-13 20:40 0 4076 推荐指数:

查看详情

236. Lowest Common Ancestor of a Binary Tree

题目: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia ...

Sun Nov 29 07:56:00 CST 2015 0 2115
[Leetcode] Balanced Binary Tree

问题:给一个二叉树,写一个算法判断这个树是不是balanced。 Solution #1. 第一次遇到这个问题时我的解法,如下: 写了一个getDepth()函数,访问每个节点都要调用一次这个函数。这个Solution也通过了leetcode的验证程序,但是后来想了想,I ...

Sun May 04 08:58:00 CST 2014 2 6363
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM