Easy Java solution using recursion


#1
public TreeNode solve(TreeNode A, TreeNode B) {
        if(A == null && B == null)
			return null;
		else if(A != null && B == null)
			return A;
		else if(A == null && B != null)
			return B;
		TreeNode node = new TreeNode(A.val + B.val);
		node.left = solve(A.left, B.left);
		node.right = solve(A.right, B.right);
		return node;
    }