Facebook Pixel

You are on level: Student

0%
Expand section
Expand section
Expand section
Expand section
Expand section
Expand section
Expand section
Expand section
Expand section
Expand section
Expand section

Subtree of Another Tree

Given two binary trees root and subRoot, determine if subRoot is a subtree of root. A subtree of a binary tree is a tree that consists of a node in the tree and all of its descendants. An empty tree is considered a subtree of any tree (including another empty tree).

Input:

Subtree of Another Tree

Output: true

Invest in Yourself
Your new job is waiting. 83% of people that complete the program get a job offer. Unlock unlimited access to all content and features.
Go Pro