Skip to content

Commit aca4191

Browse files
committed
Create 0027-remove-element.kt
1 parent 0f47800 commit aca4191

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

kotlin/0027-remove-element.kt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
fun removeElement(nums: IntArray, `val`: Int): Int {
3+
var pointer = 0
4+
for(n in nums){
5+
if(n != `val`){
6+
nums[pointer] = n
7+
pointer++
8+
}
9+
}
10+
return pointer
11+
}
12+
13+
}

0 commit comments

Comments
 (0)