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 45ff2a2 commit ae73269Copy full SHA for ae73269
maximum-subarray/devyejin.py
@@ -0,0 +1,10 @@
1
+class Solution:
2
+ def maxSubArray(self, nums: list[int]) -> int:
3
+ dp = [0] * len(nums)
4
+ dp[0] = nums[0]
5
+
6
+ for i in range(1, len(nums)):
7
+ dp[i] = max(nums[i], dp[i - 1] + nums[i])
8
9
+ return max(dp)
10
0 commit comments