diff --git "a/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" "b/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" index 677c72c6dd12de41f4bd740a23b906da616d9123..48187e7489cc96b3d2d5d99cef99a6af6dfac82d 100644 --- "a/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" @@ -130,7 +130,8 @@ public: class Solution { public int lengthOfLIS(int[] nums) { int[] dp = new int[nums.length]; - int res = 0; + // 此处res初始值必须为1,因为1 <= nums.length <= 2500 + int res = 1; Arrays.fill(dp, 1); for (int i = 1; i < dp.length; i++) { for (int j = 0; j < i; j++) {