diff --git a/2021/ruby/.ruby-version b/2021/ruby/.ruby-version new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/2021/ruby/.ruby-version @@ -0,0 +1 @@ +3 diff --git a/2021/ruby/day_01.rb b/2021/ruby/day_01.rb new file mode 100644 index 0000000..0448081 --- /dev/null +++ b/2021/ruby/day_01.rb @@ -0,0 +1,2 @@ +p ARGF.read.split("\n").map(&:to_i).each_cons(2).count {|x,y| x < y } +p ARGF.read.split("\n").map(&:to_i).each_cons(3).map(&:sum).each_cons(2).count {|x,y| x < y }