[Leetcode]226. Invert Binary Tree
来源:互联网 发布:c语言最大公倍数 编辑:程序博客网 时间:2024/05/16 08:32
Invert a binary tree.
4 / \ 2 7 / \ / \1 3 6 9to
4 / \ 7 2 / \ / \9 6 3 1
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: TreeNode* invertTree(TreeNode* root) { if (root == nullptr) return root; TreeNode *temp = root->left; root->left = invertTree(root->right); root->right = invertTree(temp); return root; }};
0 0
- LeetCode 226. Invert Binary Tree
- [leetcode] 226.Invert Binary Tree
- [leetcode] 226. Invert Binary Tree
- 【LeetCode】226. Invert Binary Tree
- leetCode 226. Invert Binary Tree
- LeetCode #226. Invert Binary Tree
- [LeetCode]226. Invert Binary Tree
- 226. Invert Binary Tree LeetCode
- LeetCode 226. Invert Binary Tree
- LeetCode 226. Invert Binary Tree
- leetcode:226. Invert Binary Tree
- LeetCode 226. Invert Binary Tree
- [LeetCode]226. Invert Binary Tree
- leetcode 226. Invert Binary Tree
- 【LeetCode】226. Invert Binary Tree
- #leetcode#226. Invert Binary Tree
- LeetCode *** 226. Invert Binary Tree
- leetcode: 226. Invert Binary Tree
- 架构设计:系统间通信(4)——IO通信模型和JAVA实践 中篇
- 【九度OJ】:1058
- C语言中sync()
- VelocityTracker的使用方法
- 浅谈 C++ 中的 new/delete 和 new[]/delete[]
- [Leetcode]226. Invert Binary Tree
- linux下忘记mysql密码的找回方法--谷营中西
- 自定义控件_day01
- fsync()
- 使用arduino作为programer对新的mcu烧录bootloader
- linux下忘记mysql密码的找回方法--谷营中西
- Deep Learning -- Caffe学习
- win7 host 中 vbox 虚拟机无法 attach USB device的问题
- mysql单表多次自关联查询