PIXELBANKv9.1.0
Menu

Given two binary trees (level-order arrays), check if they are structurally identical with the same node values.

Example:

Input:
1,2,3
1,2,3
Output:
True
Reasoning:
  • The two input arrays 1,2,3 and 1,2,3 represent two binary trees in level-order traversal.
  • We compare the two arrays node by node: both have the same root node value 1, the same left child node value 2, and the same right child node value 3.
  • Since the arrays have the same length and all corresponding node values match, we conclude that the two binary trees are structurally identical with the same node values.
  • The function returns True, indicating that the two input trees are the same.

Constraints:

  • 0 <= number of nodes <= 100
🔒

Editor locked

The code editor is locked for Pro problems. It is only available for free problems. Please upgrade to gain access to the code editor for all problems.

solution.py

Test Results

0/0
Run code to see test results.