Skip to content

Commit 2fe1f21

Browse files
Update maximum_subarray_sum.py
1 parent 578c6fc commit 2fe1f21

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

data_structures/arrays/maximum_subarray_sum.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ def max_subarray_sum(arr: list[int]) -> int:
77
88
Returns:
99
Maximum sum possible in a subarray
10+
11+
Examples:
12+
>>> max_subarray_sum([1, 3, 2])
13+
6
14+
15+
>>> max_subarray_sum([1, 2, 3, -1, 0])
16+
6
1017
"""
1118
ans = arr[0]
1219

@@ -21,8 +28,7 @@ def max_subarray_sum(arr: list[int]) -> int:
2128

2229

2330
if __name__ == "__main__":
24-
arr = list(map(int, input().split(" ")))
25-
print(max_subarray_sum(arr))
31+
print(max_subarray_sum([1,2,3,4,5]))
2632
import doctest
2733

2834
doctest.testmod()

0 commit comments

Comments
 (0)