remove unnecessary variable

This commit is contained in:
Vitor Oliveira 2021-03-09 19:21:14 -08:00
parent aeb7ee9e53
commit fb2e8a9fd2

View file

@ -26,10 +26,9 @@
# @return {Integer} # @return {Integer}
def largest_altitude(gain) def largest_altitude(gain)
arr = [0] arr = [0]
points = gain.count
# calculate altitude array # calculate altitude array
(1..points).each do |pointer| (1..gain.count).each do |pointer|
sum = arr[pointer - 1] + gain[pointer - 1] sum = arr[pointer - 1] + gain[pointer - 1]
arr.push(sum) arr.push(sum)
end end