two test cases are failing, i’m matching no of elements at each level .
Two test cases failing
@akshatkaush hey yiur logic is not correct ,you don’t have to count no of nodes just see whether given root is not NULL and check for left and right subtrees using recursion,here ios pseudo code:
bool isIdentical(node *root1,node *root2){
if(root1==NULL&&root2==NULL)
return true;
if(root1!=NULL&&root2!=NULL){
bool lt=isIdentical(root1->left,root2->left);
bool rt=isIdentical(root1->right,root2->right);
return (lt && rt);
}
return false;
}