Skip to content

Commit

Permalink
Add 2024, day 11, first part
Browse files Browse the repository at this point in the history
  • Loading branch information
bewuethr committed Dec 11, 2024
1 parent 10de35b commit 21d032d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions 2024/day11/day11a
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env ruby

stones = File.read(ARGV[0]).split

25.times do
stones_new = stones.flat_map do |n|
if n == "0"
"1"
elsif n.length.even?
[n[...n.length / 2], n[n.length / 2..].to_i.to_s]
else
(n.to_i * 2024).to_s
end
end

stones = stones_new
end

puts stones.length

0 comments on commit 21d032d

Please sign in to comment.