simpler ruby
This commit is contained in:
parent
6ee2030df0
commit
48e48a8429
1 changed files with 3 additions and 0 deletions
3
06/06_refactored.rb
Normal file
3
06/06_refactored.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
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?
|
Loading…
Reference in a new issue