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; + } +} +``` + -----------------------