摘要:
LeetCode 530.二叉搜索树的最小绝对差 分析1.0 二叉搜索树,中序遍历形成一个升序数组,节点差最小值一定在中序遍历两个相邻节点产生 ✡✡✡ 即 双指针思想在树遍历中的应用 class Solution { TreeNode pre;// 记录上一个遍历的结点 int result = I 阅读全文
posted @ 2023-02-07 21:48
cupxu
阅读(30)
评论(0)
推荐(0)
摘要:
LeetCode 654.最大二叉树 分析1.0 if(start == end) return节点索引 locateMaxNode(arr,start,end) new root = 最大索引对应节点 max.right = 最大节点右侧子数组的最大值 要保证能够递归 max.left = 最大节 阅读全文
posted @ 2023-02-07 00:15
cupxu
阅读(24)
评论(0)
推荐(0)

浙公网安备 33010602011771号