[2020][ruby][6.x] refactor

pull/2/head
Alpha Chen 4 years ago
parent 5fa382329f
commit e49d6c4bef

@ -1,6 +1,6 @@
# p ARGF.read.split("\n\n").map {|g| g.gsub("\n", "").chars.uniq.count }.sum
p ARGF.read.split("\n\n").map {|group|
people = group.split("\n").map(&:chars)
first = people.shift
first.count {|answer| people.all? {|answers| answers.include?(answer) }}
}.sum
group.split("\n").map(&:chars)
}.map {|group|
# group.inject(&:|)
group.inject(&:&)
}.map(&:size).sum

Loading…
Cancel
Save