Skip to content

Commit a8b230d

Browse files
Add files via upload
1 parent 99af601 commit a8b230d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Maximum Subarray/Maximum_Subarray.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# 48ms 87.3%
2+
class Solution:
3+
def maxSubArray(self, nums):
4+
"""
5+
:type nums: List[int]
6+
:rtype: int
7+
"""
8+
for index in range(1, len(nums)):
9+
if nums[index - 1] > 0:
10+
nums[index] += nums[index - 1]
11+
return max(nums)

0 commit comments

Comments
 (0)