纠正0027的Swift答案

Swift答案写错了。改成对的答案。
This commit is contained in:
jonathanx111
2022-04-09 13:49:55 -04:00
committed by GitHub
parent eeba1786c9
commit 2e18054079

View File

@ -281,9 +281,7 @@ 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
}
}