Skip to content

Latest commit

 

History

History
27 lines (23 loc) · 463 Bytes

375.md

File metadata and controls

27 lines (23 loc) · 463 Bytes

LintCode 375 Clone Binary Tree——easy


375. Clone Binary Tree
For the given binary tree, return a deep copy of it.
Example
Given a binary tree:
     1
   /  \
  2    3
 / \
4   5

return the new binary tree with same structure and same value:
     1
   /  \
  2    3
 / \
4   5

思路:递归
1、new 一个新节点记为newRoot 
2、递归左右子节点
3、return newRoot