OOracle·DSASDE-1Online Assessment
Invert a Binary Tree
Problem
Invert a binary tree (mirror it) and return the root.
Example
[4,2,7,1,3,6,9] -> [4,7,2,9,6,3,1]
Constraints
- 0 ≤ nodes ≤ 100
Approach
Recursively swap children, or iterative BFS/DFS.
added 6 days ago