[LintCode] Maximum Subarray 最大子数组
Posted Grandyang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LintCode] Maximum Subarray 最大子数组相关的知识,希望对你有一定的参考价值。
Given an array of integers, find a contiguous subarray which has the largest sum.
Notice
The subarray should contain at least one number.
Example
Given the array [−2,2,−3,4,−1,2,1,−5,3]
, the contiguous subarray [4,−1,2,1]
has the largest sum = 6
.
Challenge
Can you do it in time complexity O(n)?
s
以上是关于[LintCode] Maximum Subarray 最大子数组的主要内容,如果未能解决你的问题,请参考以下文章
lintcode-easy-Maximum Depth of Binary Tree
[LintCode] Maximum Subarray 最大子数组
lintcode-medium-Binary Tree Maximum Path Sum