diff --git "a/problems/0101.345円257円271円347円247円260円344円272円214円345円217円211円346円240円221円.md" "b/problems/0101.345円257円271円347円247円260円344円272円214円345円217円211円346円240円221円.md" index 36b39740d0..1b777dd527 100644 --- "a/problems/0101.345円257円271円347円247円260円344円272円214円345円217円211円346円240円221円.md" +++ "b/problems/0101.345円257円271円347円247円260円344円272円214円345円217円211円346円240円221円.md" @@ -897,6 +897,53 @@ impl Solution { } } ``` +### C# +```C# +// 递归 +public bool IsSymmetric(TreeNode root) +{ + if (root == null) return true; + return Compare(root.left, root.right); +} +public bool Compare(TreeNode left, TreeNode right) +{ + if(left == null && right != null) return false; + else if(left != null && right == null ) return false; + else if(left == null && right == null) return true; + else if(left.val != right.val) return false; + + var outside = Compare(left.left, right.right); + var inside = Compare(left.right, right.left); + + return outside&&inside; +} +``` +``` C# +// 迭代法 +public bool IsSymmetric(TreeNode root) +{ + if (root == null) return true; + var st = new Stack
diff --git "a/problems/0102.344円272円214円345円217円211円346円240円221円347円232円204円345円261円202円345円272円217円351円201円215円345円216円206円.md" "b/problems/0102.344円272円214円345円217円211円346円240円221円347円232円204円345円261円202円345円272円217円351円201円215円345円216円206円.md"
index 51d030e784..e977279c56 100644
--- "a/problems/0102.344円272円214円345円217円211円346円240円221円347円232円204円345円261円202円345円272円217円351円201円215円345円216円206円.md"
+++ "b/problems/0102.344円272円214円345円217円211円346円240円221円347円232円204円345円261円202円345円272円217円351円201円215円345円216円206円.md"
@@ -462,6 +462,32 @@ impl Solution {
}
}
```
+### C#
+```C#
+public IList
diff --git "a/problems/0226.347円277円273円350円275円254円344円272円214円345円217円211円346円240円221円.md" "b/problems/0226.347円277円273円350円275円254円344円272円214円345円217円211円346円240円221円.md"
index 1151778364..8691953a3e 100644
--- "a/problems/0226.347円277円273円350円275円254円344円272円214円345円217円211円346円240円221円.md"
+++ "b/problems/0226.347円277円273円350円275円254円344円272円214円345円217円211円346円240円221円.md"
@@ -1018,25 +1018,13 @@ public class Solution {
```csharp
//迭代
public class Solution {
- public TreeNode InvertTree(TreeNode root) {
- if (root == null) return null;
- Stack
diff --git "a/problems/344円272円214円345円217円211円346円240円221円347円232円204円350円277円255円344円273円243円351円201円215円345円216円206円.md" "b/problems/344円272円214円345円217円211円346円240円221円347円232円204円350円277円255円344円273円243円351円201円215円345円216円206円.md"
index 69007995f0..e39709b882 100644
--- "a/problems/344円272円214円345円217円211円346円240円221円347円232円204円350円277円255円344円273円243円351円201円215円345円216円206円.md"
+++ "b/problems/344円272円214円345円217円211円346円240円221円347円232円204円350円277円255円344円273円243円351円201円215円345円216円206円.md"
@@ -695,6 +695,67 @@ impl Solution {
}
}
```
+### C#
+```C#
+// 前序遍历
+public IList