From e15548aabc97d639b7bb42321fe7d8e048ba9872 Mon Sep 17 00:00:00 2001 From: Libin YANG Date: Wed, 10 Dec 2025 07:21:08 +0800 Subject: [PATCH] feat: add csharp solution to lc problem: No.3577 --- .../README.md | 18 ++++++++++++++++++ .../README_EN.md | 18 ++++++++++++++++++ .../Solution.cs | 13 +++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 solution/3500-3599/3577.Count the Number of Computer Unlocking Permutations/Solution.cs diff --git a/solution/3500-3599/3577.Count the Number of Computer Unlocking Permutations/README.md b/solution/3500-3599/3577.Count the Number of Computer Unlocking Permutations/README.md index a831982b8ccd9..681e8876240f2 100644 --- a/solution/3500-3599/3577.Count the Number of Computer Unlocking Permutations/README.md +++ b/solution/3500-3599/3577.Count the Number of Computer Unlocking Permutations/README.md @@ -207,6 +207,24 @@ impl Solution { } ``` +#### C# + +```cs +public class Solution { + public int CountPermutations(int[] complexity) { + const int mod = (int) 1e9 + 7; + long ans = 1; + for (int i = 1; i < complexity.Length; ++i) { + if (complexity[i] <= complexity[0]) { + return 0; + } + ans = ans * i % mod; + } + return (int) ans; + } +} +``` + diff --git a/solution/3500-3599/3577.Count the Number of Computer Unlocking Permutations/README_EN.md b/solution/3500-3599/3577.Count the Number of Computer Unlocking Permutations/README_EN.md index ef76ed93f5892..c46c22e1d01d8 100644 --- a/solution/3500-3599/3577.Count the Number of Computer Unlocking Permutations/README_EN.md +++ b/solution/3500-3599/3577.Count the Number of Computer Unlocking Permutations/README_EN.md @@ -203,6 +203,24 @@ impl Solution { } ``` +#### C# + +```cs +public class Solution { + public int CountPermutations(int[] complexity) { + const int mod = (int) 1e9 + 7; + long ans = 1; + for (int i = 1; i < complexity.Length; ++i) { + if (complexity[i] <= complexity[0]) { + return 0; + } + ans = ans * i % mod; + } + return (int) ans; + } +} +``` + diff --git a/solution/3500-3599/3577.Count the Number of Computer Unlocking Permutations/Solution.cs b/solution/3500-3599/3577.Count the Number of Computer Unlocking Permutations/Solution.cs new file mode 100644 index 0000000000000..c7a066af48bd9 --- /dev/null +++ b/solution/3500-3599/3577.Count the Number of Computer Unlocking Permutations/Solution.cs @@ -0,0 +1,13 @@ +public class Solution { + public int CountPermutations(int[] complexity) { + const int mod = (int) 1e9 + 7; + long ans = 1; + for (int i = 1; i < complexity.Length; ++i) { + if (complexity[i] <= complexity[0]) { + return 0; + } + ans = ans * i % mod; + } + return (int) ans; + } +}