aoc/2020/06/06_refactored.rb
2020-12-10 17:11:17 -06:00

3 lines
251 B
Ruby

groups = File.read("input.txt").split("\n\n").map(&:split)
puts groups.map { |group| group.join.chars.uniq.size }.sum # TIL about uniq
puts groups.map { |group| group.map(&:chars).reduce(&:&).size }.sum # TIL you can use & on arrays and not just sets?