--------------------------

水题

AC代码:

/**
* Definition of TreeNode:
* public class TreeNode {
* public int val;
* public TreeNode left, right;
* public TreeNode(int val) {
* this.val = val;
* this.left = this.right = null;
* }
* }
*/
public class Solution {
/**
* @param root: The root of binary tree
* @return root of new tree
*/
public TreeNode cloneTree(TreeNode root) {
if(root==null) return null;
TreeNode copycat=new TreeNode(root.val);
copycat.left=cloneTree(root.left);
copycat.right=cloneTree(root.right);
return copycat;
}
}

题目来源: http://www.lintcode.com/zh-cn/problem/clone-binary-tree/#

最新文章

  1. IE浏览器版本判断 HTML代码
  2. css整理-02 颜色和字体
  3. RabbitMQ学习笔记3-使用topic交换器
  4. CSS3小分队——进击的border-radius
  5. 转:21副GIF动图让你了解各种数学概念
  6. sublimeformaya
  7. POJ 1778 All Discs Considered(拓扑排序)
  8. iOS APP之本地数据存储(译)
  9. UILabel自适应高度,自动换行
  10. springmvc中关于静态资源的放行
  11. jQuery Easy UI Resizable(调整大小)组件
  12. Linux下查找大文件以及目录
  13. js转base64(数字)
  14. 一文搞懂TCP与UDP的区别
  15. PYthon3:函数实现“自动售卖机”功能
  16. C# Window Service安装、卸载、恢复选项操作
  17. [nodejs] nodejs开发个人博客(三)载入页面
  18. u-boot移植(十三)---代码修改---裁剪及环境变量 二
  19. Windows远程桌面,连接被拒绝,因为没有授权此用户帐户进行远程登录。
  20. Android实现动态改变屏幕方向(Landscape & Portrait)

热门文章

  1. 利用django创建一个投票网站(三)
  2. 埃拉托色尼筛法(Sieve of Eratosthenes)求素数。
  3. 借助Html制作渐变的网页背景颜色
  4. Newtonsoft.Json高级用法
  5. remove name="ProxyModule“会导致重复执行
  6. centos 7.0 firewall 防火墙常用命令
  7. 初识pipeline
  8. php 时间戳与日期的转换(转载)
  9. C# 反射研究
  10. C/C++面试题集锦(一)