摘要:
leetcode:104. 二叉树的最大深度 - 力扣(LeetCode) 思路:递归判断每次左右节点的是否存在,存在自然加一,return的1就是这样,判断子节点的左右两端是否有节点,统计有的节点数量,也就是左右的高度 class Solution { public int maxDepth(Tr 阅读全文
摘要:
二叉树的定义: public class TreeNode{ int val; TreeNode Left; TreeNode Right; TreeNode(){} TreeNode( int val){ this.val = val; } public TreeNode(int val, Tre 阅读全文