Skip to content

Instantly share code, notes, and snippets.

@yuheiomori
Created May 8, 2012 21:46
Show Gist options
  • Save yuheiomori/2639626 to your computer and use it in GitHub Desktop.
Save yuheiomori/2639626 to your computer and use it in GitHub Desktop.
CodeEval Set Intersection
import sys
if __name__ == '__main__':
test_cases = open(sys.argv[1], 'r')
for line in test_cases:
lists = line.rstrip().split(';')
l1, l2 = [l.split(',') for l in lists]
intersection = list(set(l1).intersection(set(l2)))
intersection.sort()
print ','.join(intersection)
test_cases.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment