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. --- problems/0674.最长连续递增序列.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0674.最长连续递增序列.md b/problems/0674.最长连续递增序列.md index 79a8311d..1e79b797 100644 --- a/problems/0674.最长连续递增序列.md +++ b/problems/0674.最长连续递增序列.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. --- problems/0053.最大子序和(动态规划).md | 2 -- 1 file changed, 2 deletions(-) diff --git a/problems/0053.最大子序和(动态规划).md b/problems/0053.最大子序和(动态规划).md index c7d1b2fd..bd490912 100644 --- a/problems/0053.最大子序和(动态规划).md +++ b/problems/0053.最大子序和(动态规划).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 --- problems/0674.最长连续递增序列.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0674.最长连续递增序列.md b/problems/0674.最长连续递增序列.md index 1e79b797..79a8311d 100644 --- a/problems/0674.最长连续递增序列.md +++ b/problems/0674.最长连续递增序列.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])