We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 686c2e9 + ace28db commit 091497bCopy full SHA for 091497b
1 file changed
swift/0027-Remove-Element.swift
@@ -0,0 +1,12 @@
1
+class Solution {
2
+ func removeElement(_ nums: inout [Int], _ val: Int) -> Int {
3
+ var count: Int = 0
4
+
5
+ for i in nums where i != val {
6
+ nums[count] = i
7
+ count += 1
8
+ }
9
10
+ return count
11
12
+}
0 commit comments