Update 0617.合并最大二叉树,添加C#版

This commit is contained in:
eeee0717
2023-11-26 10:29:53 +08:00
parent cbb3cf962c
commit 26816ec04f

View File

@ -788,6 +788,20 @@ impl Solution {
}
}
```
### C#
```C#
public TreeNode MergeTrees(TreeNode root1, TreeNode root2)
{
if (root1 == null) return root2;
if (root2 == null) return root1;
root1.val += root2.val;
root1.left = MergeTrees(root1.left, root2.left);
root1.right = MergeTrees(root1.right, root2.right);
return root1;
}
```
<p align="center">
<a href="https://programmercarl.com/other/kstar.html" target="_blank">