mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-18 18:14:34 +08:00
clean of unnecessary checks, imports, calls (#7993)
This commit is contained in:
@ -11,10 +11,8 @@ def max_sub_array_sum(a: list, size: int = 0):
|
||||
max_ending_here = 0
|
||||
for i in range(0, size):
|
||||
max_ending_here = max_ending_here + a[i]
|
||||
if max_so_far < max_ending_here:
|
||||
max_so_far = max_ending_here
|
||||
if max_ending_here < 0:
|
||||
max_ending_here = 0
|
||||
max_so_far = max(max_so_far, max_ending_here)
|
||||
max_ending_here = max(max_ending_here, 0)
|
||||
return max_so_far
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user