今際の国の呵呵君
Tuesday, January 27, 2015
[LintCode]Maximum Subarray Difference
这道题的解法是max subarray,min subarray,max subarray II的结合,不细说了,注意左边要维护两个数组分别是globalMax和globalMin,右边时候同理的,localMax和localMin,DP方程参考之前的题目,时间复杂度O(n),空间复杂度O(n),代码如下:
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment