Something went wrong. Try again.
Code for the Advent of Code event
aoc advent-of-code
Something went wrong. Try again.
340 B · 24 lines
Lua
at rust
12345678910111213141516171819202122232425#!/usr/bin/env lua
local nums = {}for line in io.lines('input') do nums[#nums + 1] = tonumber(line)end
local count = 0for i = 1, #nums - 1 do if nums[i] < nums[i + 1] then count = count + 1 endend
print(count)
count = 0for i = 1, #nums - 3 do if nums[i] < nums[i + 3] then count = count + 1 endend
print(count)