Invert Binary Tree
Easy
Topics
Given the root of a binary tree, invert it (swap every left and right child) and return the root. Output is the inverted tree in level order.
Example 1
Input: root = [4,2,7,1,3,6,9] Output: [4,7,2,9,6,3,1]
Example 2
Input: root = [] Output: []
Constraints
- 0 <= number of nodes <= 100
- -100 <= Node.val <= 100
Run ⌘' · Submit ⌘⏎