首页 > 其他分享 >leetcode-100-easy

leetcode-100-easy

时间:2022-10-13 18:11:25浏览次数:42  
标签:right return easy isSameTree && TreeNode 100 null leetcode

Same Tree

public boolean isSameTree(TreeNode p, TreeNode q) {
    if (p == null && q == null) return true;
    if (p != null && q == null) return false;
    if (p == null && q != null) return false;

    return isSameTree(p.left, q.left) &&
            p.val == q.val &&
            isSameTree(p.right, q.right);
}

标签:right,return,easy,isSameTree,&&,TreeNode,100,null,leetcode
From: https://www.cnblogs.com/iyiluo/p/16789183.html

相关文章