From 752cfda89351cc2d54897a6309a181f197cc6c50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A1=9C=E5=B0=8F=E8=B7=AF=E4=B8=83=E8=91=89?=
<20304773@qq.com>
Date: Tue, 31 May 2022 23:46:41 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=880027.=E7=A7=BB?=
=?UTF-8?q?=E9=99=A4=E5=85=83=E7=B4=A0.md=EF=BC=89=EF=BC=9A=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=20C#=20=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
problems/0027.移除元素.md | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/problems/0027.移除元素.md b/problems/0027.移除元素.md
index 3a93ac88..5e7742ee 100644
--- a/problems/0027.移除元素.md
+++ b/problems/0027.移除元素.md
@@ -329,5 +329,20 @@ int removeElement(int* nums, int numsSize, int val){
}
```
+C#:
+```csharp
+public class Solution {
+ public int RemoveElement(int[] nums, int val) {
+ int slow = 0;
+ for (int fast = 0; fast < nums.Length; fast++) {
+ if (val != nums[fast]) {
+ nums[slow++] = nums[fast];
+ }
+ }
+ return slow;
+ }
+}
+```
+
-----------------------
From 90075121ecd61558cb50d80668298fb4263c6cc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A1=9C=E5=B0=8F=E8=B7=AF=E4=B8=83=E8=91=89?=
<20304773@qq.com>
Date: Wed, 1 Jun 2022 19:47:53 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=880977.=E6=9C=89?=
=?UTF-8?q?=E5=BA=8F=E6=95=B0=E7=BB=84=E7=9A=84=E5=B9=B3=E6=96=B9.md?=
=?UTF-8?q?=EF=BC=89=EF=BC=9A=E5=A2=9E=E5=8A=A0=20C#=20=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
problems/0977.有序数组的平方.md | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/problems/0977.有序数组的平方.md b/problems/0977.有序数组的平方.md
index 0e79a3d6..f1b0e4ec 100644
--- a/problems/0977.有序数组的平方.md
+++ b/problems/0977.有序数组的平方.md
@@ -394,6 +394,24 @@ object Solution {
}
```
-
+C#:
+```csharp
+public class Solution {
+ public int[] SortedSquares(int[] nums) {
+ int k = nums.Length - 1;
+ int[] result = new int[nums.Length];
+ for (int i = 0, j = nums.Length - 1;i <= j;){
+ if (nums[i] * nums[i] < nums[j] * nums[j]) {
+ result[k--] = nums[j] * nums[j];
+ j--;
+ } else {
+ result[k--] = nums[i] * nums[i];
+ i++;
+ }
+ }
+ return result;
+ }
+}
+```
-----------------------