Easy · Trees
Invert Binary Tree
Given the root of a binary tree, mirror it in place by swapping the left and right children of every node, and return its root.
Examples
Example 1
[1,2,3,4,5,6,7]Output: [1,3,2,7,6,5,4]
Example 2
[4,2,7,1,3,6,9]Output: [4,7,2,9,6,3,1]
Rebuild it in the studio
Core interview problems are free with a full runner and lessons; Pro opens the complete library.