Mirror Binary Tree Nodes

Given the root node of a binary tree, swap the left and right children for each node.

Statement

Given the root node of a binary tree, swap the left and right children for each node, such that the binary tree becomes a mirror image of itself.

Example

The below example shows what the mirrored binary tree looks like:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.