diff --git a/data_structures/arrays/remove_elements.rb b/data_structures/arrays/remove_elements.rb index b8c36e3..86d068e 100644 --- a/data_structures/arrays/remove_elements.rb +++ b/data_structures/arrays/remove_elements.rb @@ -71,8 +71,8 @@ def remove_element(nums, val) while pointer1 < pointer2 if nums[pointer1] == val - nums[pointer1] = nums[pointer2 - 1] pointer2 -= 1 + nums[pointer1] = nums[pointer2] else pointer1 += 1 end