Skip to content

Commit 62db690

Browse files
Time: 79 ms (49.96%) | Memory: 32 MB (66.30%) - LeetSync
1 parent a4fc3c5 commit 62db690

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+
import math
2+
3+
class Solution:
4+
def maxSubArray(self, nums: List[int]) -> int:
5+
m = -math.inf
6+
7+
c = 0
8+
9+
for num in nums:
10+
c += num
11+
m = max(m, c)
12+
c = max(c, 0)
13+
14+
return m

0 commit comments

Comments
 (0)