Skip to content

Commit 0fd659f

Browse files
author
jinbeom
committed
Missing Number Solution
1 parent 8c3ed23 commit 0fd659f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

missing-number/kayden.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# 시간복잡도: O(N)
2+
# 공간복잡도: O(1)
3+
class Solution:
4+
def missingNumber(self, nums: List[int]) -> int:
5+
n = len(nums)
6+
total = n*(n+1)//2
7+
return total - sum(nums)

0 commit comments

Comments
 (0)