Invert Binary Tree
来源:互联网 发布:jsp在线考试系统源码 编辑:程序博客网 时间:2024/05/29 19:15
Invert a binary tree.
4 / \ 2 7 / \ / \1 3 6 9to
4 / \ 7 2 / \ / \9 6 3 1code #迭代# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution(object): def invertTree(self, root): """ :type root: TreeNode :rtype: TreeNode """ if root: root.left,root.right=root.right,root.left self.invertTree(root.right) self.invertTree(root.left) return root
1 0
- [leetcode] Invert Binary Tree
- [LeetCode]Invert Binary Tree
- Invert Binary Tree
- leetcode:Invert Binary Tree
- Invert Binary Tree
- LeetCode Invert Binary Tree
- 226Invert Binary Tree
- LeetCode | Invert Binary Tree
- leetcode--Invert Binary Tree
- [leetcode] Invert Binary Tree
- [LeetCode] Invert Binary Tree
- LeetCode Invert Binary Tree
- Invert Binary Tree
- leetcode : Invert Binary Tree
- 226Invert Binary Tree
- Invert Binary Tree
- [LeetCode] Invert Binary Tree
- [Leetcode]Invert Binary Tree
- C++虚函数表
- [Python] 十六进制整数与ASCii编码字符串相互转换
- Qt之QHostAddress 类的使用
- [Javascript学习99---代码片段收集]
- 数学之美番外篇:平凡而又神奇的贝叶斯方法
- Invert Binary Tree
- Python安装httplib2
- 动态加载进阶,从组件到容器
- 数据库的表复制语句SELECT INTO 和 INSERT INTO SELECT
- adb命令capy文件夹中的文件到手机sdcard中
- 解决Eclipse添加新server时无法选择Tomcat8的问题
- 2017/04/24
- 第5次作业报告
- 三层架构与MVC架构的区别