31.leetcode题目226: Invert Binary Tree
来源:互联网 发布:java 浏览器下载文件 编辑:程序博客网 时间:2024/06/10 05:29
题目:
Invert a binary tree.
4 / \ 2 7 / \ / \1 3 6 9
to
4 / \ 7 2 / \ / \9 6 3 1
分析:递归调用
class Solution {public: TreeNode* invertTree(TreeNode* root) { if(root==NULL) return root; TreeNode* temp=root->left; root->left=root->right; root->right=temp; root->left=invertTree(root->left); root->right=invertTree(root->right); return root; }};
Invert a binary tree.
4 / \ 2 7 / \ / \1 3 6 9
to
4 / \ 7 2 / \ / \9 6 3 1
0 0
- 31.leetcode题目226: Invert Binary Tree
- leetcode -- Invert Binary Tree -- 简单题目看看
- Leetcode[226]-Invert Binary Tree
- LeetCode 226 Invert Binary Tree
- Invert Binary Tree - LeetCode 226
- 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 226Invert 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
- css3动画animation属性
- Given an unsorted integer array, find the first missing positive integer.
- 输入三角形的三个边,判断是否为等边三角形
- 在CentOS7上安装MySQL
- iOS开发之通知中心、KVC、KVO
- 31.leetcode题目226: Invert Binary Tree
- 服务器监控
- Android推送技术研究
- Codeforces Round #346 (Div. 2) C.Tanya and Toys
- j2se数据类型
- Rails应用部署
- 浅谈移动端之touch事件--手指的上滑、下滑、左滑和右滑
- spring mvc 返回json中去除null字段
- 谷歌大脑科学家 Caffe缔造者 贾扬清 微信讲座完整版