From d6b1f3e9538c67b5592a0d93aee4df70a652ab96 Mon Sep 17 00:00:00 2001 From: JaneyLin <105125897+janeyziqinglin@users.noreply.github.com> Date: Tue, 2 May 2023 23:28:44 -0400 Subject: [PATCH 1/3] =?UTF-8?q?Update=200674.=E6=9C=80=E9=95=BF=E8=BF=9E?= =?UTF-8?q?=E7=BB=AD=E9=80=92=E5=A2=9E=E5=BA=8F=E5=88=97.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix bug. --- ...\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" "b/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" index 79a8311d78..1e79b797d6 100644 --- "a/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" +++ "b/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" @@ -212,7 +212,7 @@ class Solution: return 0 result = 1 dp = [1] * len(nums) - for i in range(len(nums)-1): + for i in range(len(nums)): if nums[i+1] > nums[i]: #连续记录 dp[i+1] = dp[i] + 1 result = max(result, dp[i+1]) From ae3fc9f57688e6369f593e6dab8e8f1d55a8c919 Mon Sep 17 00:00:00 2001 From: JaneyLin <105125897+janeyziqinglin@users.noreply.github.com> Date: Wed, 3 May 2023 21:02:58 -0400 Subject: [PATCH 2/3] =?UTF-8?q?Update=200053.=E6=9C=80=E5=A4=A7=E5=AD=90?= =?UTF-8?q?=E5=BA=8F=E5=92=8C=EF=BC=88=E5=8A=A8=E6=80=81=E8=A7=84=E5=88=92?= =?UTF-8?q?=EF=BC=89.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 题目已定义1 <= nums.length. --- ...\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" | 2 -- 1 file changed, 2 deletions(-) diff --git "a/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" "b/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" index c7d1b2fd7b..bd49091269 100644 --- "a/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" +++ "b/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" @@ -139,8 +139,6 @@ Python: ```python class Solution: def maxSubArray(self, nums: List[int]) -> int: - if len(nums) == 0: - return 0 dp = [0] * len(nums) dp[0] = nums[0] result = dp[0] From b794dccc5b40c1fa25dc2413edd0bbfda9e20aac Mon Sep 17 00:00:00 2001 From: JaneyLin <105125897+janeyziqinglin@users.noreply.github.com> Date: Wed, 3 May 2023 21:05:55 -0400 Subject: [PATCH 3/3] =?UTF-8?q?Update=200674.=E6=9C=80=E9=95=BF=E8=BF=9E?= =?UTF-8?q?=E7=BB=AD=E9=80=92=E5=A2=9E=E5=BA=8F=E5=88=97.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" "b/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" index 1e79b797d6..79a8311d78 100644 --- "a/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" +++ "b/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" @@ -212,7 +212,7 @@ class Solution: return 0 result = 1 dp = [1] * len(nums) - for i in range(len(nums)): + for i in range(len(nums)-1): if nums[i+1] > nums[i]: #连续记录 dp[i+1] = dp[i] + 1 result = max(result, dp[i+1])