Solution for Day 03
This commit is contained in:
12
day_03/first.rb
Normal file
12
day_03/first.rb
Normal file
@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
input = File.readlines './input'
|
||||
width = input.first.strip.size
|
||||
count = 0
|
||||
|
||||
input.each_with_index do |row, i|
|
||||
next if i == 0
|
||||
|
||||
count += 1 if row[(i * 3) % width] == '#'
|
||||
end
|
||||
puts count
|
Reference in New Issue
Block a user