LeeCode-Invert Binary Tree
来源:互联网 发布:乐高机器人编程教程 编辑:程序博客网 时间:2024/06/10 15:42
Invert a binary tree.
4 / \ 2 7 / \ / \1 3 6 9
to
4 / \ 7 2 / \ / \9 6 3 1
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { public TreeNode invertTree(TreeNode root) { if(root!=null) { TreeNode temp = root.left; root.left = root.right; root.right = temp; invertTree(root.left); invertTree(root.right); return root; } return null; }}
0 0
- LeeCode Invert Binary Tree
- LeeCode-Invert Binary Tree
- [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
- 设计模式分类(创建型模式、结构型模式、行为模式)
- OC中的深复制与浅复制
- Asymptote_ghostscript
- PE 521【DP】
- ubuntu14 apt-get 安装java8 ppa
- LeeCode-Invert Binary Tree
- HTTP基础
- Mybatis中模糊查询的各种写法
- 【CodeForces 397B 】On Corruption and Numbers(规律)
- java面对大数据 并发时候的分治思想及继承的高级运用
- 用lsof统计程序打开的句柄数量
- 集合问题
- LeeCode-Majority Element
- LCD驱动中pixclock的计算