Skip to content

Instantly share code, notes, and snippets.

@cmatheson
Created December 6, 2021 20:11
Show Gist options
  • Save cmatheson/929d7e1f7752e3baba4065d677f0679f to your computer and use it in GitHub Desktop.
Save cmatheson/929d7e1f7752e3baba4065d677f0679f to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
fishes = 9.times.map { 0 }
gets.split(",").map(&:to_i).each { |x| fishes[x] += 1 }
256.times do
new_fishes = fishes.shift
fishes << new_fishes
fishes[6] += new_fishes
end
p fishes.sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment