Checking whether Subtree or not!

Use KMP search and then try. If you don’t know KMP learn it.

Also-

1 Like