Skip to content

Commit a8a0629

Browse files
committed
Time: 0 ms (100%), Space: 18 MB (0%) - LeetHub
1 parent e639f33 commit a8a0629

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# time complexity: O(n)
2+
# space complexity: O(n)
3+
from typing import List
4+
5+
6+
class Solution:
7+
def missingMultiple(self, nums: List[int], k: int) -> int:
8+
numSet = set(nums)
9+
for num in range(1, 100000):
10+
if num * k not in numSet:
11+
return num * k
12+
13+
14+
nums = [8, 2, 3, 4, 6]
15+
k = 2
16+
print(Solution().missingMultiple(nums, k))
17+
nums = [1, 4, 7, 10, 15]
18+
k = 5
19+
print(Solution().missingMultiple(nums, k))

0 commit comments

Comments
 (0)