22 lines
287 B
Ruby
22 lines
287 B
Ruby
|
#!/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
|