Skip to content

Instantly share code, notes, and snippets.

@st0le
Created April 26, 2013 03:31
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 st0le/5464885 to your computer and use it in GitHub Desktop.
Save st0le/5464885 to your computer and use it in GitHub Desktop.
Find first missing number in a strictly increasing array. (where X > A[0])
def find_first_gap_linear(lst):
for i in xrange(len(r)-1):
if r[i] + 1 != r[i+1]:
return r[i] + 1
return -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment