Just 4 Lines Solution

interview-questions
Tags: #<Tag:0x00007f243a84d8d8>

#1
int Solution::isSameTree(TreeNode* A, TreeNode* B) {
    if(A==NULL && B==NULL) return 1;
    if(A==NULL || B==NULL) return 0;
    if(A->val != B->val) return 0;
    return Solution::isSameTree(A->left, B->left) & Solution::isSameTree(A->right, B->right);
}