Update 0300.最长上升子序列.md

最新力扣新增测试案例
nums = [0] 预期输出 1 实际输出 0
就是nums.length == 0 时 要return 1
This commit is contained in:
LePing Huang 2023-12-05 16:52:40 +08:00 committed by GitHub
parent f47dd60148
commit a18bca3625
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -130,7 +130,7 @@ public:
class Solution {
public int lengthOfLIS(int[] nums) {
int[] dp = new int[nums.length];
int res = 0;
int res = 1;
Arrays.fill(dp, 1);
for (int i = 1; i < dp.length; i++) {
for (int j = 0; j < i; j++) {