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 712a408 commit 11fba4bCopy full SHA for 11fba4b
longest-increasing-subsequence/Seoya0512.py
@@ -0,0 +1,11 @@
1
+'''
2
+Dynamic Programming 문제로 누적합을 이용해 풀어보려 했으나 끝내 해결을 못해 참고했습니다.
3
4
+class Solution:
5
+ def lengthOfLIS(self, nums: List[int]) -> int:
6
+ dp = [1] * len(nums)
7
+ for cur in range(1, len(nums)):
8
+ for prev in range(len(nums)):
9
+ if nums[prev] < nums[cur]:
10
+ dp[cur] = max(1+dp[prev], dp[cur])
11
+ return max(dp)
0 commit comments