Skip to content

Commit f83e884

Browse files
committed
Time: 1487 ms (74.00%), Space: 16.8 MB (18.71%) - LeetHub
1 parent 5ae250d commit f83e884

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution:
2+
def lengthOfLIS(self, nums: List[int]) -> int:
3+
4+
dp = [0] * (len(nums) + 1)
5+
6+
for i in range(len(nums)):
7+
maximum = 0
8+
9+
for j in range(i):
10+
11+
if nums[i] > nums[j] and dp[j] > maximum:
12+
maximum = dp[j]
13+
14+
dp[i] = maximum + 1
15+
16+
return max(dp)

0 commit comments

Comments
 (0)