I am a javascript newbie so bear with me. I have lists as so:
var list1 = ['a','b','c'];
var list2 = ['c','d','e'];
var list3 = ['f','g'];
As you see, list1 and list2 intersect at 'c' while list3 is disjoint from both list1 and list2.
The result should be
['a','b','c','d','e'],['f','g'] // Two arrays
We have combined list1 and list2 since they intersect while leaving list3 as is. Another example:
var list1 = ['a','b','c'];
var list2 = ['d','e','f'];
var list3 = ['f','g','a'];
Here we see list1 and list2 don't intersect, list1 intersects with list3 at 'a' and list2 intersects list3 at 'f'. So since all 3 intersect, the result returned would be:
['a','b','c','d','e','f','g'] // One array
Any help is appreciated
KA
PS: I did search the site for a similar problem and I came across one intersection of n lists via JS Its similar but doesn't serve my use case.