mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 15:45:40 +08:00
@ -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
|
||||
|
Reference in New Issue
Block a user