```
class Solution {
public:
bool isSubtree(TreeNode* s, TreeNode* t) {
if(!s && !t) return true;
if(s && t){
if (s->val == t->val)if( isSubtree(s->left,t->left ) && isSubtree(t->right, s->right)) return true;
if(isSubtree(s->left, t)) return true;
if(isSubtree(s->right, t)) return true;
}
return false;
}
};
```