Skip to content

Instantly share code, notes, and snippets.

@gbazilio
Created January 11, 2017 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbazilio/dd2f2e06c2972239050bbaf7238b8033 to your computer and use it in GitHub Desktop.
Save gbazilio/dd2f2e06c2972239050bbaf7238b8033 to your computer and use it in GitHub Desktop.
Codility - Missing integer
def solution(A):
count_length = len(A)
count_array = [0] * (count_length + 1)
for value in A:
if value > 0 and value <= count_length:
count_array[value-1] += 1
for index in xrange(len(count_array)):
if count_array[index] == 0:
return index+1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment