Skip to content

Commit ccd6444

Browse files
committed
Time: 538 ms (47.15%), Space: 30.9 MB (72.36%) - LeetHub
1 parent 1ce7d1e commit ccd6444

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)