Standard Bar Binary Trees · Medium Problems O(n) · O(h)
A glasswork atelier hand-builds chandeliers as binary branch trees, and a wealthy client ordered two supposedly identical pieces. Before shipping, the quality clerk hangs both on rigging and compares them joint by joint: every joint must hold the same crystal grade, and every branch must fork the same way. A single mismatched fork or swapped child disqualifies the pair.
Input: Two binary trees p and q, each given as a level-order array where null marks a missing child.
Output: Return true if the trees are structurally identical with matching values at every position, false otherwise.
0 <= number of nodes in each tree <= 10^5-100 <= node value <= 100Input: {"p":[1,2,3],"q":[1,2,3]}
Output: true
Same shape, same values at every joint — identical pieces.
Input: {"p":[1,2],"q":[1,null,2]}
Output: false
The branch hangs left in p but right in q — a structural mismatch.