Compare commits

..

No commits in common. "8bd7ab3b2f80104dca12bd51ffd7594b02ff7625" and "4358ca34b31b9aeb9031650da765824faebfbe3c" have entirely different histories.

3 changed files with 2 additions and 1026 deletions

View File

@ -1,8 +1,3 @@
# Advent of Code 2018 # AoC2018
This is a repo for my Advent of Code 2018 solutions. AoC 2018 code.
I'll be trying to solve challenges using Ruby and editing in VS Code to learn both better.
I'm using 2018 challenges as a warm up for 2021 AoC.
Link: https://adventofcode.com/

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +0,0 @@
#!/bin/env ruby
# Sum all numbers in the text file.
# Part 1
sum = File.readlines('./input').map { |line| line.to_i}.sum
# Part 2
numbers = File.readlines('./input').map { |line| line.to_i}
freqs = [0]
numbers.cycle do |num|
freqs.push(freqs[-1] + num)
break if freqs[0..-2].include?(freqs[-1])
end
puts freqs[-1]