Created
April 25, 2020 15:20
-
-
Save hazurd/cbe973c969854fd31267a729db7d1dc1 to your computer and use it in GitHub Desktop.
Return a unique integer from a set of two lists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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