Challenge: Identical Trees

Let’s check if two binary trees are equal.

Problem

Find out if two binary trees have identical values.

Input

Two binary trees.

Output

Returns true if the given trees are identical. Otherwise, it returns false.

Sample input

The root nodes t.root and t2.root of two binary trees will be our input. We have to find if the trees are identical using the isEqual() function.

Get hands-on with 1400+ tech skills courses.