my-solutions/advent-of-code/2024/day_10/main.rb

12 lines
270 B
Ruby

require_relative 'lib'
input = File.readlines('input.txt', chomp: true)
matrix = input.map do |row|
row.split('').map { |n| Integer(n) }
end
res1 = count_reachable_positions(matrix)
puts("Part 1: #{res1}")
res2 = count_hiking_trails(matrix)
puts("Part 2: #{res2}")