Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Invert Binary Tree
Bookmark
Input
Example 1
Simple Tree
Left Child Only
Custom
tree
=
[4, 2, 7, 1, 3, 6, 9]
4
2
7
1
3
6
9
stack
invert: swap children at every node
algo
master
.
io
Step:
Start: invert the tree by swapping children at every node
0 / 25
Input
Example 1
Simple Tree
Left Child Only
Custom
tree
=
[4, 2, 7, 1, 3, 6, 9]
0 / 25
4
2
7
1
3
6
9
stack
invert: swap children at every node
algo
master
.
io
Step:
Start: invert the tree by swapping children at every node