st0le
4/26/2013 - 3:31 AM

Find first missing number in a strictly increasing array. (where X > A[0])

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