diff --git a/data_structures/arrays/get_products_of_all_other_elements.rb b/data_structures/arrays/get_products_of_all_other_elements.rb index 7283e92..b164bfb 100644 --- a/data_structures/arrays/get_products_of_all_other_elements.rb +++ b/data_structures/arrays/get_products_of_all_other_elements.rb @@ -148,7 +148,7 @@ def products(nums) # so the product would be 1 product = 1 - (nums.count - 1).downto(1).each do |i| + (nums.count - 1).downto(1) do |i| num = nums[i] # For the index 'i', product would contain the # product of all elements to the right. We update product accordingly.