https://oj.leetcode.com/problems/same-tree/
判断两棵树是不是一样
递归是树结构的第一思路。
public class Solution {
public boolean isSameTree(TreeNode p, TreeNode q) {
if(p==null||q==null)return p==null&&q==null;
if(p.val!=q.val)return false;
return isSameTree(p.left,q.left)&&isSameTree(p.right,q.right);
}
}