Skip to content

Instantly share code, notes, and snippets.

@hazurd
Created April 25, 2020 15:20
Show Gist options
  • Save hazurd/cbe973c969854fd31267a729db7d1dc1 to your computer and use it in GitHub Desktop.
Save hazurd/cbe973c969854fd31267a729db7d1dc1 to your computer and use it in GitHub Desktop.
Return a unique integer from a set of two lists
def solution(x, y):
unique = None
work_list = longest([x, y])
if work_list == x:
compare_list = y
else:
compare_list = x
for i in work_list:
if i not in compare_list:
unique = i
return unique
def longest(paths):
return max(paths, key=len)
solution([14, 27, 1, 4, 2, 50, 3, 1], [2, 4, -4, 3, 1, 1, 14, 27, 50])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment