Skip to content
C

Check Identical Trees

Easyjavapythonccppjavascript

Given two binary trees, determine whether they have exactly the same structure and the same value at every corresponding node.

Input Format

The first line contains an integer M1 and the second line the M1 level-order tokens of tree A (blank if M1 is 0). The third line contains an integer M2 and the fourth line the M2 level-order tokens of tree B (blank if M2 is 0).

Output Format

Print 1 if the trees are identical, otherwise print 0.

Input (stdin)

Output

Run your code to see output here...