Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 26816ec

Browse files
committed
Update 0617.合并最大二叉树,添加C#版
1 parent cbb3cf9 commit 26816ec

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎problems/0617.合并二叉树.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,20 @@ impl Solution {
788788
}
789789
}
790790
```
791+
### C#
792+
```C#
793+
public TreeNode MergeTrees(TreeNode root1, TreeNode root2)
794+
{
795+
if (root1 == null) return root2;
796+
if (root2 == null) return root1;
797+
798+
root1.val += root2.val;
799+
root1.left = MergeTrees(root1.left, root2.left);
800+
root1.right = MergeTrees(root1.right, root2.right);
801+
802+
return root1;
803+
}
804+
```
791805

792806
<p align="center">
793807
<a href="https://programmercarl.com/other/kstar.html" target="_blank">

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /