摘要: 1、没利用完全二叉树性质的递归 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { v 阅读全文
posted @ 2020-07-19 11:16 浅滩浅 阅读(694) 评论(0) 推荐(0)
摘要: 1、递归后序遍历 class Solution { public int maxDepth(TreeNode root) { if(root == null) return 0; return Math.max(maxDepth(root.left), maxDepth(root.right)) + 阅读全文
posted @ 2020-07-19 10:38 浅滩浅 阅读(123) 评论(0) 推荐(0)