Skip to content

Commit

Permalink
Merge pull request youngyangyang04#2504 from LingFenglong/master
Browse files Browse the repository at this point in the history
Update 0300.最长上升子序列.md
  • Loading branch information
youngyangyang04 authored May 3, 2024
2 parents b23f1a9 + 9437047 commit 75711c7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion problems/0300.最长上升子序列.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public:
```Java
class Solution {
public int lengthOfLIS(int[] nums) {
if (nums.length <= 1) return nums.length;
int[] dp = new int[nums.length];
int res = 1;
Arrays.fill(dp, 1);
Expand All @@ -137,8 +138,8 @@ class Solution {
if (nums[i] > nums[j]) {
dp[i] = Math.max(dp[i], dp[j] + 1);
}
res = Math.max(res, dp[i]);
}
res = Math.max(res, dp[i]);
}
return res;
}
Expand Down

0 comments on commit 75711c7

Please sign in to comment.