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 9698034 commit 61b0e11Copy full SHA for 61b0e11
1 file changed
longest-consecutive-sequence/mrlee7.py
@@ -1,6 +1,5 @@
1
from typing import List
2
3
-
4
"""
5
Ideation:
6
배열을 정렬한 뒤, 인접한 숫자들을 비교하면서 가장 긴 연속 수열의 길이를 구한다.
@@ -12,6 +11,8 @@
12
11
Time Complexity: O(n log n)
13
Space Complexity: O(1)
14
+
15
16
class Solution:
17
18
def longestConsecutive(self, nums: List[int]) -> int:
@@ -32,4 +33,4 @@ def longestConsecutive(self, nums: List[int]) -> int:
32
33
longest = max(longest, length)
34
length = 1
35
- return longest
36
+ return longest
0 commit comments