Created
April 26, 2013 03:31
-
-
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])
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 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