# Subtree of Another Tree

Try to solve the Subtree of Another Tree problem.

## We'll cover the following

## Statement

Given the roots of two binary trees, `root`

and `subRoot`

, return TRUE if there is a subtree of `root`

with the same structure and nodes as `subRoot`

. Otherwise, return FALSE.

A tree can only be considered a subtree of the `root`

tree iff all the descendants (children) of the node appear in `subRoot`

.

**Constraints:**

The number of nodes in the

`root`

tree is in the range$[1,500].$ The number of nodes in the

`subRoot`

tree is in the range$[1,250].$ $âˆ’10^4 \leq$ `root.data`

$\leq 10^4$ $âˆ’10^4 \leq$ `subRoot.data`

$\leq 10^4$

## Examples

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.