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