You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
p ARGF.read
|
|
.scan(/(\d+)-(\d+),(\d+)-(\d+)/)
|
|
.map { _1.map(&:to_i) }
|
|
.map {|a,b,c,d| [(a..b), (c..d)] }
|
|
# .count {|a,b| a.cover?(b) || b.cover?(a) } # part 1
|
|
.count {|a,b| a.minmax.any? { b.cover?(_1) } || b.minmax.any? { a.cover?(_1) }}
|