2022/06/script.rb

22 lines
287 B
Ruby
Raw Permalink Normal View History

2022-12-06 11:59:50 +01:00
#!/usr/bin/env ruby
require_relative '../common'
class Day06 < Day
def part1
find_marker 4
end
def part2
find_marker 14
end
private
def find_marker(size)
size + stdin.join.chars.each_cons(size).find_index { |chars| chars == chars.uniq }
end
end
Day06.run