I just can't figure out a nice way to solve the following problem:

For an event I have n parties (`party_id`

) taking part. Each party has m `availabilities`

for said event in the form of `start_date`

and `end_date`

.

What I would like to know is all possible combinations of overlapping `availabilities`

containing exactly one `availability`

for each `party_id`

. I discovered Interval Trees (https://en.wikipedia.org/wiki/Interval_tree) which might be utilized, but as I said I can't quite figure it out.

So thanks for any thoughts on that!