Two Trees
100. Same Tree
100Same Tree
Two binary trees are considered the same if they are structurally identical, and the nodes have the same values in the same positions.
101. Symmetric Tree
A tree is symmetric if the left subtree is a mirror reflection of the right subtree. This means comparing left.left with right.right and left.right with right.left.
572. Subtree of Another Tree
subRoot is a subtree of root when some node of root, taken together with everything below it, is identical to subRoot.
1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree
Given two binary trees original and cloned, and a reference to a target node in the original tree, find the corresponding node in the cloned tree. The cloned tree is a deep copy of the original tree.
872. Leaf-Similar Trees
Two trees are leaf-similar if their leaf values, read left to right, form the same sequence. Generate each tree's leaf sequence with a DFS and compare. The recursive variants use a generator (yield) so leaves stream out in order; the O(1)-space variants compare lazily with zip_longest instead of materializing both lists.