Skip to content

Commit f6528f6

Browse files
committed
Time: 1870 ms (61.45%), Space: 17.7 MB (20.94%) - LeetHub
1 parent e68a691 commit f6528f6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from typing import List
2+
3+
4+
class Solution:
5+
def lengthOfLIS(self, nums: List[int]) -> int:
6+
countList = [1] * len(nums)
7+
for i in range(1, len(nums)):
8+
for j in range(i):
9+
if nums[i] > nums[j]:
10+
countList[i] = max(countList[i], countList[j] + 1)
11+
return max(countList)
12+
13+
14+
nums = [0, 1, 0, 3, 2, 3]
15+
print(Solution().lengthOfLIS(nums))

0 commit comments

Comments
 (0)