03 2024 档案
摘要:98验证二叉搜索树 开始想的是递归验证 root.right.val>root.val&&root.left.val<root.val;但是会出现以下情况 二叉搜索树的中序遍历是有序数组是解决二叉搜索树问题的关键。 点击查看代码 class Solution { TreeNode max; publ
阅读全文
摘要:前序中序,后序中序确定一颗二叉树。 后序中序确定的思路: 从postorder中取出最后一个数 以这个数为分界点分割中序数组 再根据中序的分组分割后序数组 点击查看代码 class Solution { Map<Integer,Integer> map = new HashMap<>(); publ
阅读全文
摘要:https://leetcode.cn/problems/path-sum-ii 点击查看代码 class Solution { public List<List<Integer>> pathSum(TreeNode root, int targetSum) { List<List<Integer>
阅读全文
浙公网安备 33010602011771号