[Leetcode从零开刷]226. Invert Binary Tree
来源:互联网 发布:奔驰诊断软件下载 编辑:程序博客网 时间:2024/06/05 21:50
题目来源:
leetcode
Invert a binary tree.
翻译:颠倒一个二叉树
解题:
如果不是根节点不用交换。
代码如下,
class Solution {public: TreeNode* invertTree(TreeNode* root) { if(!root) return root; else { swap(root->left,root->right); } invertTree(root->right); invertTree(root->left); 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
- [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.537 Complex Number Multiplication
- HDOJ 2550 百步穿杨
- DP
- [Leetcode从零开刷]226. Invert Binary Tree
- Virtual Box虚拟机文件瘦身处理
- Windows系统以及Mac系统/Linux系统配置环境变量
- Ansible中自定义变量的使用
- openssl 根据证书生成p7b证书链
- 【YOLO学习】召回率(Recall),精确率(Precision),平均正确率(Average_precision(AP) ),交除并(Intersection-over-Union(IoU))
- pusher websocket client,基于golang
- Spring IOC 和 AOP
- 两年小前端裸辞求职经历