ICode9

精准搜索请尝试: 精确搜索
  • LeetCode面试题 04.06. 后继者2022-07-01 19:01:40

    LeetCode面试题 04.06. 后继者 求中序遍历中给定节点的后一个节点,分右子树中/父节点中 # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution:

  • leetcode 每日一题 面试题 04.06. 后继者2022-05-16 09:31:39

    leetcode 每日一题  面试题 04.06. 后继者 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { boolean b = false;

  • 面试题 04.06. 后继者2022-05-08 21:34:14

    题目表述 设计一个算法,找出二叉搜索树中指定节点的“下一个”节点(也即中序后继)。 如果指定节点没有对应的“下一个”节点,则返回null。 示例 1: 输入: root = [2,1,3], p = 1 2 / 1 3 输出: 2 解题思路 只有两种情况 p没有右子树 p有右子树 如果有右子树的话,那么只需要直接根

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有