mirror of
https://github.com/TheAlgorithms/Ruby
synced 2025-01-14 08:01:05 +01:00
minor change
This commit is contained in:
parent
afef73db10
commit
d5877acb14
1 changed files with 1 additions and 1 deletions
|
@ -71,8 +71,8 @@ def remove_element(nums, val)
|
||||||
|
|
||||||
while pointer1 < pointer2
|
while pointer1 < pointer2
|
||||||
if nums[pointer1] == val
|
if nums[pointer1] == val
|
||||||
nums[pointer1] = nums[pointer2 - 1]
|
|
||||||
pointer2 -= 1
|
pointer2 -= 1
|
||||||
|
nums[pointer1] = nums[pointer2]
|
||||||
else
|
else
|
||||||
pointer1 += 1
|
pointer1 += 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue