Skip to content

Commit 790e221

Browse files
author
Dominik Schauer
committed
added solutions to class Solution:
1 parent 22764e6 commit 790e221

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

algorithms/268_Missing_Number_set.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Solution:
2+
def missingNumber(self, nums: List[int]) -> int:
3+
return tuple(set(range(len(nums)+1)) - set(nums))[0]

algorithms/268_Missing_Number_sort.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution:
2+
def missingNumber(self, nums: List[int]) -> int:
3+
4+
nums.sort()
5+
6+
for i in range(len(nums)):
7+
if(nums[i] != i):
8+
return i
9+
10+
return len(nums)

0 commit comments

Comments
 (0)