Two trees are the same if roots match and left/right subtrees are the same.
DFS simultaneously. If both nodes are null, true. If one null or values differ, false.
Structural equality and value equality must hold at every corresponding node.
Two trees are the same if roots match and left/right subtrees are the same.
DFS simultaneously. If both nodes are null, true. If one null or values differ, false.
Structural equality and value equality must hold at every corresponding node.