Something went wrong. Try again.
Code for the Advent of Code event
aoc advent-of-code
Something went wrong. Try again.
246 B · 15 lines
at rust
12345678910111213141516#!/usr/bin/env crystal
freqs = File.read_lines("input.txt").map(&.to_i)
puts "Part 1: #{freqs.sum}"
multiples = Set(Int32).newfreq = 0
freqs.cycle do |current| freq += current break unless multiples.add? freqend
puts "Part 2: #{freq}"