# Easy-题目4：226. Invert Binary Tree

Invert a binary tree.

 4


/ \
2 7
/ \ / \
1 3 6 9
to
4
/ \
7 2
/ \ / \
9 6 3 1
Trivia:
This problem was inspired by this original tweet by Max Howell:
Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off.

struct TreeNode* invertTree(struct TreeNode* root) {
if(!root)
return NULL;
struct TreeNode* temp = root->left;
root->left = invertTree(root->right);
root->right = invertTree(temp);
return root;
}

0ms,beats0%.众数：0ms.100%
Cmershen的碎碎念：

#### 226. Invert Binary Tree [easy] (Python)

2016-05-12 14:36:34

#### 【LeetCode】226. Invert Binary Tree 解题报告

2016-05-29 00:18:13

#### leetcode 226 Invert Binary Tree 翻转二叉树

2015-06-23 23:53:58

#### Leetcode 226: Invert Binary Tree(二叉树反转 递归、非递归实现)

2015-06-13 14:41:43

#### 【LeetCode-面试算法经典-Java实现】【226-Invert Binary Tree（反转二叉树）】

2015-08-30 06:24:34

#### PAT_A 1102. Invert a Binary Tree (25)

2016-10-23 10:19:12

#### C#版 - 226. Invert Binary Tree(剑指offer 面试题19) - 题解

2018-06-10 15:56:23

#### 1102 Invert a Binary Tree

2016-02-25 16:49:43

#### Invert Binary Tree 递归

2016-05-15 16:45:56

#### 226. Invert Binary Tree

2018-06-10 10:21:52