f = ->a, b {a.zip(b).map {|c| (c.first...c.last).to_a}.inject(:|).size}p f.([1,3,5], [2,4,6])p f.([1,2], [5,6])p f.([100,1,2], [105,3,4])
Standard input is empty
3 5 8
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!