Easiest answer in Java


#1

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

}

}