We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 27d5af9 commit d890103Copy full SHA for d890103
300-Longest-Increasing-Subsequence.py
@@ -0,0 +1,9 @@
1
+class Solution:
2
+ def lengthOfLIS(self, nums: List[int]) -> int:
3
+ LIS = [1] * len(nums)
4
+
5
+ for i in range(len(nums) - 1, -1, -1):
6
+ for j in range(i + 1, len(nums)):
7
+ if nums[i] < nums[j]:
8
+ LIS[i] = max(LIS[i], 1 + LIS[j])
9
+ return max(LIS)
0 commit comments