Leetcode#226. Invert Binary Tree
Problem
Given the root
of a binary tree, invert the tree, and return its root.
Example 1:
1 | Input: root = [4,2,7,1,3,6,9] |
Example 2:
1 | Input: root = [2,1,3] |
Example 3:
1 | Input: root = [] |
Constraints:
- The number of nodes in the tree is in the range
[0, 100]
. 100 <= Node.val <= 100
Solve
1 | # Definition for a binary tree node. |
1 | class Solution: |
本部落格所有文章除特別聲明外,均採用 CC BY-NC-SA 4.0 許可協議。轉載請註明來自 Imisky!
評論