Scratch Services | Number of days where at least one person is working

For example, let’s say you have 3 developers: A, B and C. They report the following working schedule:
Developer A: day 3 - 5 (You can think of it as Thursday through Saturday)
Developer B: day 1 and 5 (Tuesday and Saturday)
Developer C: day 0 - 1 and 5 - 6 (Monday, Tuesday, Saturday and Sunday)

problem statement: count the number of days where at least one person is working

  • days can be any positive digit.

sample input for above example would be:

[ // list of emloyees
    [ // list of times for empoyee A
	    [3,5] // list with times
	],
	[ // employee B
	    [1,1],[5,5]
	],
	[ // employee C
	    [0,1],[5-6]
	]
]
Comments (5)