We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb1b9b7 commit 6c6a87cCopy full SHA for 6c6a87c
maximum-subarray/evan.py
@@ -0,0 +1,13 @@
1
+from typing import List
2
+
3
4
+class Solution:
5
+ def maxSubArray(self, nums: List[int]) -> int:
6
+ global_max_sum = nums[0]
7
+ local_max_sum = nums[0]
8
9
+ for num in nums[1:]:
10
+ local_max_sum = max(num, local_max_sum + num)
11
+ global_max_sum = max(global_max_sum, local_max_sum)
12
13
+ return global_max_sum
0 commit comments