LintCode: 最小子数组
2016-09-08 00:28
274 查看
LintCode: 最小子数组
class Solution: """ @param nums: a list of integers @return: A integer denote the sum of minimum subarray """ def minSubArray(self, nums): # write your code here if not nums: return n = len(nums) dp = [0 for i in range(n)] dp[0] = nums[0] ans = nums[0] for i in range(1, n): dp[i] = min(dp[i-1] + nums[i], nums[i]) ans = min(ans, dp[i]) return ans
相关文章推荐
- lintcode-44-最小子数组
- lintcode 44.最小子数组
- Lintcode最小子数组
- lintcode编程题 java实现:(一)和大于S的最小子数组
- LintCode--最小子数组
- lintcode 容易题:Minimum Subarray 最小子数组
- LintCode_044_最小子数组
- LintCode: 和大于S的最小子数组
- LintCode_044_最小子数组
- Lintcode-贪心-最大子数组和最小子数组
- LintCode:M-和大于S的最小子数组
- lintcode最小子数组
- LintCode_373_奇偶分割数组
- LintCode_子数组之和
- LintCode 43 最大子数组 III
- LintCode 数组剔除元素后的乘积
- Lintcode删除排序数组的重复数字
- LintCode - 数组 - 132 Pattern
- lintcode 42 最大子数组 II 解析
- lintcode convert-sorted-array-to-binary-search-tree-with-minimal-height 把排序数组转换为高度最小的二叉搜索树