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 6e4f683 commit e60be98Copy full SHA for e60be98
1 file changed
longest-increasing-subsequence/sangbeenmoon.py
@@ -0,0 +1,27 @@
1
+# hint 를 보고 해결.
2
+# DP 로도 풀 수 있음.
3
+
4
+class Solution:
5
+ def lengthOfLIS(self, nums: List[int]) -> int:
6
+ seq = []
7
8
9
+ for num in nums:
10
+ if len(seq) == 0:
11
+ seq.append(num)
12
+ continue
13
14
+ i = 0
15
16
+ while seq[i] < num:
17
+ i = i + 1
18
19
+ if i > len(seq) - 1:
20
+ break
21
22
23
24
+ else:
25
+ seq[i] = num
26
27
+ return len(seq)
0 commit comments