diff --git a/problems/0027.移除元素.md b/problems/0027.移除元素.md index 03c58b43..9d687cfb 100644 --- a/problems/0027.移除元素.md +++ b/problems/0027.移除元素.md @@ -339,7 +339,6 @@ int removeElement(int* nums, int numsSize, int val){ } ``` - Kotlin: ```kotlin fun removeElement(nums: IntArray, `val`: Int): Int { @@ -351,7 +350,6 @@ fun removeElement(nums: IntArray, `val`: Int): Int { } ``` - Scala: ```scala object Solution { @@ -368,5 +366,20 @@ object Solution { } ``` +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; + } +} +``` + -----------------------