class Solution:
def mergeTrees(self , t1 , t2 ):
# write code here
if not t1:
return t2
if not t2:
return t1
first = TreeNode(0)
first.left = t1
left = 1
right = 1
## sign=1 left sign=0 right
def dfs(root1, root2, pre, sign):
if not root1 and root2:
root1 = TreeNode(root2.val)
if sign:
pre.left = root1
else:
pre.right = root1
elif not root2:
return
else:
root1.val = root2.val + root1.val
dfs(root1.left, root2.left, root1, 1)
dfs(root1.right, root2.right, root1, 0)
dfs(t1, t2, first, 1)
return first.left