mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 07:35:35 +08:00
Merge pull request #2504 from LingFenglong/master
Update 0300.最长上升子序列.md
This commit is contained in:
@ -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);
|
||||
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user