Same Tree
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 public class Solution { 2 public boolean isSameTree(TreeNode p, TreeNode q) { 3 if(p==null) return q==null; 4 if(q==null) return p==null; 5 if(p.val==q.val){ 6 return isSameTree(p.left,q.left)&&isSameTree(p.right,q.right); 7 } 8 else return false; 9 } 10 }