LEET1 LeetCode 226. Invert Binary Tree Problem: Invert a binary tree. Example: -Summary- Solved recursively 1. Until root node exist, we keep traverse left and right and change the left and right subtree by exchanging value. (By calling the function recursively) Here is another solution by solving this iteratively using stack. def invertTree(self, root): stack = [root] while stack: node = stack.pop() if node: node.left, node.right = .. 2020. 6. 20. 이전 1 다음