From fb2e8a9fd268b8603a641c29f80cd2be22b350ee Mon Sep 17 00:00:00 2001 From: Vitor Oliveira Date: Tue, 9 Mar 2021 19:21:14 -0800 Subject: [PATCH] remove unnecessary variable --- data_structures/arrays/find_the_highest_altitude.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/data_structures/arrays/find_the_highest_altitude.rb b/data_structures/arrays/find_the_highest_altitude.rb index 73287b1..680b880 100644 --- a/data_structures/arrays/find_the_highest_altitude.rb +++ b/data_structures/arrays/find_the_highest_altitude.rb @@ -26,10 +26,9 @@ # @return {Integer} def largest_altitude(gain) arr = [0] - points = gain.count # calculate altitude array - (1..points).each do |pointer| + (1..gain.count).each do |pointer| sum = arr[pointer - 1] + gain[pointer - 1] arr.push(sum) end