判断走右子树是否对应相等
public class Solution { /** * * @param p TreeNode类 * @param q TreeNode类 * @return bool布尔型 */ public boolean isSameTree (TreeNode p, TreeNode q) { // write code here 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); } }