175.翻转二叉树
来源:互联网 发布:雷阿伦生涯总数据 编辑:程序博客网 时间:2024/06/01 19:26
题目:翻转一棵二叉树
样例:
1 1 / \ / \2 3 => 3 2 / \ 4 4
代码:
class Solution {public: /** * @param root: a TreeNode, the root of the binary tree * @return: nothing */ void invertBinaryTree(TreeNode *root) { // write your code here if(root==NULL) return; else { TreeNode *t=root->left; root->left=root->right; root->right=t; invertBinaryTree(root->left); invertBinaryTree(root->right); } }};
0 0
- 175.翻转二叉树
- LintCode - 175.翻转二叉树
- [LintCode]175.翻转二叉树
- C++二叉树翻转
- 翻转二叉树
- 翻转二叉树
- 题目:翻转二叉树
- LintCode 翻转二叉树
- LinkCode-翻转二叉树
- 翻转二叉树
- 翻转二叉树
- 翻转二叉树
- LintCode_175_翻转二叉树
- 二叉树翻转
- lintcode ----翻转二叉树
- lintcode,翻转二叉树
- 翻转二叉树
- 翻转二叉树
- Linux主机驱动与外设驱动分离思想
- JAVA求学之路Junit&反射
- 蓝桥杯复数运算
- Gas Station
- Linux下php安装Redis扩展
- 175.翻转二叉树
- 实验五 继承和派生
- docker swarm 配置
- Linux初次见面
- mybatis教程--一对多查询
- LintCode 子树
- Sublime插件汇总
- C#设置double类型的数据的保存位数
- 寻找失去的账号