104. Maximum Depth of Binary Tree

    xiaoxiao2021-03-25  88

    public class Solution { public int maxDepth(TreeNode root) { if(root == null) { return 0; }else { int left = maxDepth(root.left)+1; int right = maxDepth(root.right)+1; return left>right?left:right; } } }
    转载请注明原文地址: https://ju.6miu.com/read-25977.html

    最新回复(0)