We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0fd659f commit 6f3e43eCopy full SHA for 6f3e43e
longest-common-subsequence/kayden.py
@@ -0,0 +1,17 @@
1
+# 시간복잡도: O(N)
2
+# 공간복잡도: O(N)
3
+class Solution:
4
+ def longestConsecutive(self, nums: List[int]) -> int:
5
+ nums = set(nums)
6
+ answer = 0
7
+
8
+ for num in nums:
9
+ if num - 1 not in nums:
10
+ length = 1
11
12
+ while num + length in nums:
13
+ length += 1
14
15
+ answer = max(answer, length)
16
17
+ return answer
0 commit comments