title: Is there a swift way of finding matching lists in Python?
body: <p>I have a couple of groups of lists, and I would like examine how many overlapping values they have.</p>
  <p>I have managed to do this with a couple of nested loops, but I'm wondering if there is a more runtime-efficient way, or even a function to process multiple 'groups' at once returning arrays with the most overlapping values.</p>
  <p>My code looks so far like this:</p>
  <pre><code>group1 = [['a','b','c'], ['1','2','3'], ['x','y','z','w'],['10','20','30','40']]
  group2 = [['a','b','x','z'], ['1','2','3','4','5'], ['x','y','z','q','p'],['10','50','60','70']]
  group3 = [['a','b','c','x','1'], ['1','2','3','4','6'], ['y','z','w','5'],['10','20','60','70']]
  
  def match(grp1, grp2):
      for arr1 in grp1:
          for arr2 in grp2:
              overlap = len(arr1) + len(arr2) - len(set(arr1+arr2))
              if overlap &gt; 0:
                  print(overlap, overlap/len(arr1), overlap/len(arr2), arr1, arr2)
  
  match(group1, group2)
  print()
  match(group1, group3)
  print()
  match(group3, group2)
  </code></pre>