[LeetCode]100. Same Tree判断树相同
dfs遍历一下判断
public boolean isSameTree(TreeNode p, TreeNode q) { if (p==null) { return q == null; } else { if (q==null || p.val!=q.val) return false; else { return (isSameTree(p.left,q.left)&&isSameTree(p.right,q.right)); } } }