Skip to content

Commit 091497b

Browse files
authored
Merge pull request #1931 from kabirdhillon7/27Swift
Create 0027-Remove-Element.swift
2 parents 686c2e9 + ace28db commit 091497b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

swift/0027-Remove-Element.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)