LeetCode100. 相同的树
作者:互联网
class Solution { public boolean isSameTree(TreeNode p, TreeNode q) { if (p == null && q == null) return true; if (p == null || q == null) return false; if (p.val != q.val) return false; return isSameTree(p.left, q.left) && isSameTree(p.right,q.right); } }
标签:right,return,val,相同,isSameTree,LeetCode100,TreeNode,null 来源: https://www.cnblogs.com/HuangYJ/p/14171710.html