Skip to content

Instantly share code, notes, and snippets.

@richvincent
Created December 24, 2015 12:44
Show Gist options
  • Save richvincent/5a8fa77e6fefc1fa9a63 to your computer and use it in GitHub Desktop.
Save richvincent/5a8fa77e6fefc1fa9a63 to your computer and use it in GitHub Desktop.
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