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 e64125a commit 6a2d333Copy full SHA for 6a2d333
maximum-subarray/printjin-gmailcom.py
@@ -0,0 +1,7 @@
1
+class Solution:
2
+ def maxSubArray(self, nums):
3
+ max_sum = current_sum = nums[0]
4
+ for num in nums[1:]:
5
+ current_sum = max(num, current_sum + num)
6
+ max_sum = max(max_sum, current_sum)
7
+ return max_sum
0 commit comments