16 lines
262 B
Ruby
16 lines
262 B
Ruby
def run(f)
|
|
increments = 0
|
|
previous = nil
|
|
|
|
f.each do |line|
|
|
measurement = Integer(line)
|
|
|
|
if previous and measurement > previous
|
|
increments += 1
|
|
end
|
|
|
|
previous = measurement
|
|
end
|
|
|
|
return increments
|
|
end
|