Yet Another Off By One Error
This commit is contained in:
+1
-1
@@ -544,7 +544,7 @@ def sum_max_sub_array(nums: list[int]) -> int:
|
||||
max_sum: int = sum(nums)
|
||||
|
||||
while end - begin <= len(nums):
|
||||
while end < len(nums):
|
||||
while end <= len(nums):
|
||||
max_sum = max(max_sum, sum(nums[begin:end]))
|
||||
begin += 1
|
||||
end += 1
|
||||
|
||||
Reference in New Issue
Block a user