1
$\begingroup$

There are N date ranges which include check-in date and check-out date. How can I find out the busiest day?

Example:

2016-10-12 to 2016-10-18
2016-10-11 to 2016-10-15
2016-10-13 to 2016-10-14
2016-10-12 to 2016-10-13

From these dates, it is obvious that 2016-10-12 was booked on all 4 times. How can I mathematically solve this?

Using two dates we can find out overlaps like this.

  • 0
    You can solve this easily computationally - You sort by check in and then keep a rolling counters for eqch date.2017-02-23

1 Answers 1

0

Hint -

I think you can create 4 sets for given 4 date range's. Then you can find intersection of these 4 sets.

  • 0
    these dates can be more than 52017-02-23