We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6b38053 commit f292cbaCopy full SHA for f292cba
problems/0968.监控二叉树.md
@@ -726,6 +726,31 @@ impl Solution {
726
}
727
728
729
+```
730
+### C#
731
+```csharp
732
+public class Solution
733
+{
734
+ public int res = 0;
735
+ public int MinCameraCover(TreeNode root)
736
+ {
737
+ if (Traversal(root) == 0) res++;
738
+ return res;
739
+ }
740
+ public int Traversal(TreeNode cur)
741
742
+ if (cur == null) return 2;
743
+ int left = Traversal(cur.left);
744
+ int right = Traversal(cur.right);
745
+ if (left == 2 && right == 2) return 0;
746
+ else if (left == 0 || right == 0)
747
748
+ res++;
749
+ return 1;
750
751
+ else return 2;
752
753
+}
754
```
755
756
<p align="center">
0 commit comments