-
-
Save richvincent/5a8fa77e6fefc1fa9a63 to your computer and use it in GitHub Desktop.
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 answer(numbers): | |
loop = list(set(numbers)) | |
if len(loop) > 2: | |
if loop[0] == 0: | |
return len(loop) - 1 | |
else: | |
return 2 | |
assert (answer([1, 3, 0, 1]) == 2) | |
assert (answer([1, 0]) == 2) | |
assert (answer([1, 2, 1]) == 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment