We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1ce7d1e commit ccd6444Copy full SHA for ccd6444
0053-maximum-subarray/0053-maximum-subarray.py
@@ -0,0 +1,8 @@
1
+class Solution:
2
+ def maxSubArray(self, nums: List[int]) -> int:
3
+ dp = []
4
+ dp.append(nums[0])
5
+ for i in range(1, len(nums)):
6
+ dp.append(max(dp[i - 1] + nums[i], nums[i]))
7
+
8
+ return max(dp)
0 commit comments