Leetcode 156 Binary Tree Upside Down
2016-01-28 23:04
369 查看
Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent node) or empty, flip it upside down and turn it into a tree where the original right nodes turned into left leaf nodes. Return the new
root.
For example:
Given a binary tree {1,2,3,4,5},
1
/ \
2 3
/ \
4 5
return the root of the binary tree [4,5,2,#,#,3,1].
4
/ \
5 2
/ \
3 1
参考这里
http://blog.csdn.net/whuwangyi/article/details/43186045
root.
For example:
Given a binary tree {1,2,3,4,5},
1
/ \
2 3
/ \
4 5
return the root of the binary tree [4,5,2,#,#,3,1].
4
/ \
5 2
/ \
3 1
参考这里
http://blog.csdn.net/whuwangyi/article/details/43186045
相关文章推荐
- 博客开通,留个纪念
- HttpURLConnetion的使用
- uva11183 Teen Girl Squad(最小树形图朱刘算法)
- NOIP 2015 D1 T2 信息传递
- 【工具】【电子设计】超屌的 fritzing 新建元件
- Java常见错误汇总
- dictHsCode is not mapped
- Leetcode 298 Binary Tree Longest Consecutive Sequence
- Oracle与Tomcat端口冲突,报错:Protocol handler initialization failed;Socket bind failed
- hdu(1171)——Big Event in HDU
- struts2乱码
- input文本框只能输入数字
- oracle VPD
- javascript 中的this call apply
- android-继承BaseAdapter自定义适配器,getView执行多次的解决方法
- 99%学生都不知道的Paper写作神器,Google从此是路人
- Android中将方形图片截取成圆形的两种实现方式
- 编写可读代码的艺术chapter 10-13
- input文本框只能输入数字
- 颜色数组