Skip to content

Commit 87010e1

Browse files
authored
Update kadane_algorithm.py
resolved all the issue occured during merging
1 parent e426fbe commit 87010e1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dynamic_programming/kadane_algorithm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
"""
22
Kadane's Algorithm implementation in Python.
33
4-
Finds the maximum sum of a contiguous subarray within a one-dimensional array of numbers.
4+
Finds the maximum sum of a contiguous subarray within
5+
a one-dimensional array of numbers.
56
67
Source:
78
https://en.wikipedia.org/wiki/Maximum_subarray_problem
89
"""
910

1011

11-
def kadane(arr):
12+
def kadane(arr: list[int]) -> tuple[int, list[int]]:
1213
"""
1314
Returns the maximum sum of a contiguous subarray and the subarray itself.
1415
@@ -51,11 +52,10 @@ def kadane(arr):
5152
start = s
5253
end = i
5354

54-
return max_global, arr[start : end + 1]
55+
return max_global, arr[start:end+1]
5556

5657

5758
# Doctest runner
5859
if __name__ == "__main__":
5960
import doctest
60-
6161
doctest.testmod()

0 commit comments

Comments
 (0)