I have multiple lists containing tuples, e.g.,
list_A = [(start_1, end_1), (start_2, end_2), (start_3, end_3)]
list_B = [(start_4, end_4), ...]
Is there a smart way to go about generating a result_list
that contains only the intersections, without having to search through each list in a nested fashion O(n^m)?
Example:
list_A = [('8:00 AM', '10:00 AM'), ('12:59 PM', '3:00 PM'), ('5:04 PM', '7:23 PM')]
list_B = [('9:06 AM', '9:47 AM'), ('9:51 AM', '12:45 PM'), ('1:33 PM', '2:52 PM'), ...]
list_C = [...]
list_D = [...]
# etc. etc. (m lists)
Please see the image below for an illustration of the problem: