From 61cc413a8a0a432b31df983f078bc9ec78b439da Mon Sep 17 00:00:00 2001 From: Libin YANG Date: Sat, 20 Dec 2025 07:33:15 +0800 Subject: [PATCH] feat: add cs solution to lc problem: No.0944 --- .../README.md | 23 +++++++++++++++++++ .../README_EN.md | 23 +++++++++++++++++++ .../Solution.cs | 18 +++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 solution/0900-0999/0944.Delete Columns to Make Sorted/Solution.cs diff --git a/solution/0900-0999/0944.Delete Columns to Make Sorted/README.md b/solution/0900-0999/0944.Delete Columns to Make Sorted/README.md index f40ef75ad4166..0683a68c2e447 100644 --- a/solution/0900-0999/0944.Delete Columns to Make Sorted/README.md +++ b/solution/0900-0999/0944.Delete Columns to Make Sorted/README.md @@ -208,6 +208,29 @@ impl Solution { } ``` +#### C# + +```cs +public class Solution { + public int MinDeletionSize(string[] strs) { + int m = strs[0].Length; + int n = strs.Length; + int ans = 0; + + for (int j = 0; j < m; ++j) { + for (int i = 1; i < n; ++i) { + if (strs[i][j] < strs[i - 1][j]) { + ++ans; + break; + } + } + } + + return ans; + } +} +``` + diff --git a/solution/0900-0999/0944.Delete Columns to Make Sorted/README_EN.md b/solution/0900-0999/0944.Delete Columns to Make Sorted/README_EN.md index de846637ceb44..2e7342635f5d2 100644 --- a/solution/0900-0999/0944.Delete Columns to Make Sorted/README_EN.md +++ b/solution/0900-0999/0944.Delete Columns to Make Sorted/README_EN.md @@ -211,6 +211,29 @@ impl Solution { } ``` +#### C# + +```cs +public class Solution { + public int MinDeletionSize(string[] strs) { + int m = strs[0].Length; + int n = strs.Length; + int ans = 0; + + for (int j = 0; j < m; ++j) { + for (int i = 1; i < n; ++i) { + if (strs[i][j] < strs[i - 1][j]) { + ++ans; + break; + } + } + } + + return ans; + } +} +``` + diff --git a/solution/0900-0999/0944.Delete Columns to Make Sorted/Solution.cs b/solution/0900-0999/0944.Delete Columns to Make Sorted/Solution.cs new file mode 100644 index 0000000000000..88fbf75cfa0f6 --- /dev/null +++ b/solution/0900-0999/0944.Delete Columns to Make Sorted/Solution.cs @@ -0,0 +1,18 @@ +public class Solution { + public int MinDeletionSize(string[] strs) { + int m = strs[0].Length; + int n = strs.Length; + int ans = 0; + + for (int j = 0; j < m; ++j) { + for (int i = 1; i < n; ++i) { + if (strs[i][j] < strs[i - 1][j]) { + ++ans; + break; + } + } + } + + return ans; + } +}