1 class Solution {
2 public:
3 TreeNode* mergeTrees(TreeNode* t1, TreeNode* t2) {
4 if(t1 == NULL)
5 return t2;
6
7 if(t2 == NULL)
8 return t1;
9
10 TreeNode* new_tree = new TreeNode(t1->val + t2->val);
11 new_tree->left = mergeTrees(t1->left, t2->left);
12 new_tree->right = mergeTrees(t1->right, t2->right);
13 return new_tree;
14 }
15 };