Skip to content

Commit 33c91a9

Browse files
committed
2020-09-10
1 parent dbd9372 commit 33c91a9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution(object):
2+
def findKthPositive(self, arr, k):
3+
"""
4+
:type arr: List[int]
5+
:type k: int
6+
:rtype: int
7+
"""
8+
cnt = 0
9+
s = set(arr)
10+
for i in range(1, max(arr) + k + 1):
11+
if i not in s:
12+
cnt += 1
13+
if cnt == k:
14+
return i

0 commit comments

Comments
 (0)