We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 66b2826 commit 99633e9Copy full SHA for 99633e9
53-Maximum-Subarray.py
@@ -0,0 +1,11 @@
1
+class Solution:
2
+ def maxSubArray(self, nums: List[int]) -> int:
3
+ res = nums[0]
4
+
5
+ total = 0
6
+ for n in nums:
7
+ total += n
8
+ res = max(res, total)
9
+ if total < 0:
10
11
+ return res
0 commit comments