2023年2月18日

力扣刷题——116. 填充每个节点的下一个右侧节点指针

摘要: 116. 填充每个节点的下一个右侧节点指针 一开始的想法如下,但只通过部分样例 class Solution { public Node connect(Node root) { if (root == null) { return null; } if (root.left != null) { 阅读全文

posted @ 2023-02-18 21:57 pumpkinsBig 阅读(11) 评论(0) 推荐(0)

力扣刷题——617.合并二叉树 (待优化

摘要: 617. 合并二叉树 写的时候遇到一个疑惑的点,向下面这样的写法,获得的head永远是空的,为什么不会在merge方法通过tree给head赋值?? class Solution { TreeNode head = null; public TreeNode mergeTrees(TreeNode 阅读全文

posted @ 2023-02-18 18:17 pumpkinsBig 阅读(18) 评论(0) 推荐(0)

导航