定义问题:将t1与t2合并放入t1

分解:根合并之后,分解左子树合并的结果,右子树合并的结果

边界:左右都为null返回null,左为空返回右子树,右为空返回左子树

import java.util.*;

public class Solution {
  
    public TreeNode mergeTrees (TreeNode t1, TreeNode t2) {
        // write code here
        if(t1 == null && t2 == null)return null;
        if(t2 !=null)return t2;
        if(t1 != null)return t1;
        
        t1.val += t2.val;
        
        t1.left = mergeTrees(t1.left,t2.left);
        t1.right = mergeTrees(t1.right,t2.right);
        return t1;
    }
}