From a18bca36254163df96b811b8598f2d07081369ec Mon Sep 17 00:00:00 2001 From: LePing Huang <94521862+hlp777@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:52:40 +0800 Subject: [PATCH] =?UTF-8?q?Update=200300.=E6=9C=80=E9=95=BF=E4=B8=8A?= =?UTF-8?q?=E5=8D=87=E5=AD=90=E5=BA=8F=E5=88=97.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 最新力扣新增测试案例 nums = [0] 预期输出 1 实际输出 0 就是nums.length == 0 时 要return 1 --- problems/0300.最长上升子序列.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0300.最长上升子序列.md b/problems/0300.最长上升子序列.md index 677c72c6..64f75291 100644 --- a/problems/0300.最长上升子序列.md +++ b/problems/0300.最长上升子序列.md @@ -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++) {