mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 16:54:50 +08:00
@ -249,7 +249,6 @@ class Solution {
|
|||||||
```java
|
```java
|
||||||
// 代码精简版
|
// 代码精简版
|
||||||
class Solution {
|
class Solution {
|
||||||
TreeNode pre;
|
|
||||||
public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
|
public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
|
||||||
if (root == null || root.val == p.val ||root.val == q.val) return root;
|
if (root == null || root.val == p.val ||root.val == q.val) return root;
|
||||||
TreeNode left = lowestCommonAncestor(root.left,p,q);
|
TreeNode left = lowestCommonAncestor(root.left,p,q);
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
## 513.找树左下角的值
|
## 513.找树左下角的值
|
||||||
|
|
||||||
|
题目地址:[https://leetcode-cn.com/problems/find-bottom-left-tree-value/](https://leetcode-cn.com/problems/find-bottom-left-tree-value/v)
|
||||||
|
|
||||||
给定一个二叉树,在树的最后一行找到最左边的值。
|
给定一个二叉树,在树的最后一行找到最左边的值。
|
||||||
|
|
||||||
示例 1:
|
示例 1:
|
||||||
|
Reference in New Issue
Block a user