LeetCode 226 Invert Binary Tree - Problem Statement

The problem

Given the root of a binary tree, invert it so that all left and right children are swapped, and return the root.

With a tree:

    4
   / \
  2   7
 / \ / \
1  3 6  9

After inverting:

    4
   / \
  7   2
 / \ / \
9  6 3  1

Every node swaps its left and right subtrees. This happens at every level, recursively.

Constraints: 00 \le nodes 100\le 100.