Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
zebulanmcranahn
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
by
zebulanmcranahn
12y ago
Thanks for the ValueError tip. I added it as well as a TypeError just in case the input comes in as a string. My skills are beginner level at best, tips like yours help a lot!
2.
▲
by
zebulanmcranahn
12y ago
def firstMissingPositive(A): try: for x in range(1, max(A)+1): if x not in A: return x except: return A def firstMissingPositive(A): try: return next(x for x in range(1, max(A)+1) if x not i
3.
▲
by
zebulanmcranahn
12y ago
def findMissingPositive(A): A.sort() return min([x for x in range(A[0], A[-1]+1) if x not in A])