LeetCode题解–226. Invert Binary Tree
来源:互联网 发布:sql数据库置疑怎么解决 编辑:程序博客网 时间:2024/06/08 18:21
链接
LeetCode题目:https://leetcode.com/problems/invert-binary-tree/
难度:Easy
题目
Invert a binary tree.
分析
这题比较简单,利用分治的想法就能翻转二叉树。
代码
class Solution {public: TreeNode* invertTree(TreeNode* root) { if(root == nullptr) return root; swap(root->left, root->right); invertTree(root->left); invertTree(root->right); return root; }};
阅读全文
0 0
- LeetCode题解–226. Invert Binary Tree
- leetcode 226. Invert Binary Tree 题解
- Leetcode题解 226. Invert Binary Tree
- LeetCode Algorithms 226. Invert Binary Tree 题解
- LeetCode题解:Invert Binary Tree
- LeetCode题解:Invert Binary Tree
- LeetCode 226. Invert Binary Tree 题解(C++)
- LeetCode 226. Invert Binary Tree 题解 —— Java
- LeetCode 题解(192) : 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
- c语言-算法课程设计-会场安排
- EAP 设置TimeOut 原因
- SSH项目整合实现Ajax注册用户验证
- JAVA初识
- 算法笔记--宽度优先搜索
- LeetCode题解–226. Invert Binary Tree
- 【HDU4430】【ZOJ3656】Bit Magic 2-SAT
- 数组与字符串方法
- 计算机网络基础知识
- FasterRCNN画框小程序——VOC2007格式(python)
- 在dw的itemchanged事件里面,修改当前参数data
- MySQL索引
- 关于素数筛法的一点讨论
- 远程桌面无法复制文件解决方法