Skip to content

Commit 38ee73c

Browse files
Time: 88 ms (36.05%) | Memory: 31.9 MB (87.76%) - LeetSync
1 parent ba48f6c commit 38ee73c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution:
2+
def maxSubArray(self, nums: List[int]) -> int:
3+
m = max(nums)
4+
5+
c = 0
6+
7+
for num in nums:
8+
c += num
9+
10+
m = max(m, c)
11+
12+
c = max(c, 0)
13+
14+
return m

0 commit comments

Comments
 (0)