Skip to content

Commit 4cb3a55

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 36733a8 commit 4cb3a55

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

dynamic_programming/longest_sub_array.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,32 @@
1010
"""
1111

1212

13-
def longest_sub_array(arr:list):
13+
def longest_sub_array(arr: list):
1414
"""
15-
Find the longest continuous subarray with the maximum sum.
15+
Find the longest continuous subarray with the maximum sum.
1616
17-
Args:
18-
arr (list): A list of integers.
17+
Args:
18+
arr (list): A list of integers.
1919
20-
Returns:
21-
A Integer which is the max subarray sum in the whole array.
20+
Returns:
21+
A Integer which is the max subarray sum in the whole array.
2222
23-
Examples:
24-
>>> longest_sub_array([1, 2, 3, 2, 5])
25-
13
23+
Examples:
24+
>>> longest_sub_array([1, 2, 3, 2, 5])
25+
13
2626
27-
>>> longest_sub_array([5, -4, 3, -2, 1])
28-
5
27+
>>> longest_sub_array([5, -4, 3, -2, 1])
28+
5
2929
30-
>>> longest_sub_array([1, 2, 3, -2, 5])
31-
9
30+
>>> longest_sub_array([1, 2, 3, -2, 5])
31+
9
3232
33-
>>> longest_sub_array([10, 20, -30, 40, 50])
34-
90
33+
>>> longest_sub_array([10, 20, -30, 40, 50])
34+
90
3535
36-
>>> longest_sub_array([])
37-
0
38-
"""
36+
>>> longest_sub_array([])
37+
0
38+
"""
3939

4040
max_so_far = arr[0]
4141
max_ending_here = arr[0]
@@ -58,7 +58,6 @@ def longest_sub_array(arr:list):
5858
return max_len
5959

6060

61-
6261
if __name__ == "__main__":
6362
import doctest
6463

0 commit comments

Comments
 (0)