/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class Solution {
public TreeNode invertTree(TreeNode root) {
if (root == null) return null;
TreeNode tmp = root.left;
root.left = invertTree(root.right);
root.right = invertTree(tmp);
return root;
}
}
相关文章
- 11-24【URAL1018】Binary Apple Tree
- 11-24236.Lowest Common Ancestor of a Binary Tree
- 11-2430 Day Challenge Day 7 | Leetcode 235. Lowest Common Ancestor of a Binary Search Tree
- 11-24236. Lowest Common Ancestor of a Binary Tree 二叉树的最低公共祖先
- 11-247-235. Lowest Common Ancestor of a Binary Search Tree
- 11-24letecode [235] - Lowest Common Ancestor of a Binary Search Tree
- 11-24Python3解leetcode Lowest Common Ancestor of a Binary Search TreeBinary Tree Paths
- 11-24LeetCode-236 Lowest Common Ancestor of a Binary Tree
- 11-24236. Lowest Common Ancestor of a Binary Tree
- 11-24LeetCode236. Lowest Common Ancestor of a Binary Tree(二叉树的最近公共祖先)