public class Solution {
public int isSameTree(TreeNode A, TreeNode B) {
if(A == null && B == null)
return 1;
if((A== null && B!= null) || (B == null && A != null))
return 0;
if(A.val == B.val){
int left = isSameTree(A.left,B.left);
int right = isSameTree(A.right,B.right);
if(left == 1 && right == 1)
return 1;
return 0;
}
return 0;
}
}