**Problem Statement:**
Given the required input arguments, write an efficient algorithm to solve the **Invert Binary Tree** problem. Implement the required logic as specified by standard definitions for this classic algorithmic challenge.
**Hint / Expected Approach:**
Swap children at every node (DFS or BFS)
**Edge Cases to Consider:**
- (1) Empty tree
- (2) Single node
- (3) Only one side populated
Examples
Example 1
Input:[4,2,7,1,3,6,9]
Output:[4,7,2,9,6,3,1]
Explanation: Classic example
Example 2
Input:[2,1,3]
Output:[2,3,1]
Explanation: Simple 3-node
Example 3
Input:[]
Output:[]
Explanation: Empty tree
Constraints
▪The number of nodes in the tree is in the range [0, 2000]
▪-1000 <= Node.val <= 1000
▪Ensure depth-first or breadth-first traversals are memory-efficient