Yeah
This commit is contained in:
parent
886def1a71
commit
29a614dc60
8
ruby/2017/1/problem.rb
Normal file
8
ruby/2017/1/problem.rb
Normal file
@ -0,0 +1,8 @@
|
||||
array = STDIN.read.chomp.split("").map(&:to_i)
|
||||
part_1 = array.zip(array.rotate).select { |a, b| a == b }.map(&:first).sum
|
||||
|
||||
puts "Part 1: #{part_1}"
|
||||
|
||||
part_2 = array.zip(array.rotate(array.length / 2)).select { |a, b| a == b }.map(&:first).sum
|
||||
|
||||
puts "Part 2: #{part_2}"
|
||||
Loading…
Reference in New Issue
Block a user