Given the root of a binary tree, invert the tree, and return its root.
Given the root of a binary tree, invert the tree, and return its root.
Invariant: After visiting node N, its left and right subtrees are completely inverted.
Tree problems decompose cleanly into identical subproblems on left and right subtrees.
Bottleneck: Visits each node once.
Given the root of a binary tree, invert the tree, and return its root.
Given the root of a binary tree, invert the tree, and return its root.
Invariant: After visiting node N, its left and right subtrees are completely inverted.
Tree problems decompose cleanly into identical subproblems on left and right subtrees.
Bottleneck: Visits each node once.
Initialized Binary Tree: Root Node is [4]. Level 1 has children [2, 7]. Level 2 has leaves [1, 3, 6, 9].