parent
eeba1786c9
commit
2e18054079
|
|
@ -281,10 +281,8 @@ func removeElement(_ nums: inout [Int], _ val: Int) -> Int {
|
|||
|
||||
for fastIndex in 0..<nums.count {
|
||||
if val != nums[fastIndex] {
|
||||
if slowIndex != fastIndex {
|
||||
nums[slowIndex] = nums[fastIndex]
|
||||
}
|
||||
slowIndex += 1
|
||||
slowIndex += 1
|
||||
}
|
||||
}
|
||||
return slowIndex
|
||||
|
|
|
|||
Loading…
Reference in New Issue