8000 Total Runtime: 774 ms · michaelhuang/LintCode_Python@b093309 · GitHub
[go: up one dir, main page]

Skip to content

Commit b093309

Browse files
committed
1 parent e9c7584 commit b093309

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Minimum_Subarray.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import sys
2+
3+
class Solution:
4+
"""
5+
@param nums: a list of integers
6+
@return: A integer denote the sum of minimum subarray
7+
"""
8+
def minSubArray(self, nums):
9+
min_sum, sum = sys.maxint, 0
10+
for i in nums:
11+
sum += i
12+
min_sum = min(min_sum, sum)
13+
sum = min(sum, 0)
14+
return min_sum

0 commit comments

Comments
 (0)
0