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 01bd5c4 commit a8cc3c8Copy full SHA for a8cc3c8
longest-increasing-subsequence/sejineer.py
@@ -0,0 +1,16 @@
1
+"""
2
+시간 복잡도: O(Nlog(N))
3
+공간 복잡도: O(N)
4
5
+from bisect import bisect_left
6
+
7
+class Solution:
8
+ def lengthOfLIS(self, nums: List[int]) -> int:
9
+ sub = []
10
+ for num in nums:
11
+ index = bisect_left(sub, num)
12
+ if index == len(sub):
13
+ sub.append(num)
14
+ else:
15
+ sub[index] = num
16
+ return len(sub)
0 commit comments