Invert Binary Tree
Mirror a binary tree: every node's left and right children swap places, recursively. Return the (same, mutated) root.
// [4,2,7,1,3,6,9] becomes [4,7,2,9,6,3,1]
invertTree(tree([4, 2, 7, 1, 3, 6, 9]));Mirror a binary tree: every node's left and right children swap places, recursively. Return the (same, mutated) root.
// [4,2,7,1,3,6,9] becomes [4,7,2,9,6,3,1]
invertTree(tree([4, 2, 7, 1, 3, 6, 9]));Run your code to see results.
Stuck? This challenge exercises: