We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 282f034 commit 865ae45Copy full SHA for 865ae45
csharp/27.remove-element.cs
@@ -0,0 +1,27 @@
1
+/*
2
+ * @lc app=leetcode id=27 lang=csharp
3
+ *
4
+ * [27] Remove Element
5
+ */
6
+
7
+// @lc code=start
8
+public class Solution
9
+{
10
+ public int RemoveElement(int[] nums, int val)
11
+ {
12
+ int i = 0;
13
+ for (int j = 0; j < nums.Length; j++)
14
15
+ if (nums[j] != val)
16
17
+ nums[i] = nums[j];
18
+ i++;
19
+ }
20
21
+ return i;
22
23
24
+}
25
26
+// @lc code=end
27
0 commit comments