weidagang2046的专栏

物格而后知致
随笔 - 8, 文章 - 409, 评论 - 101, 引用 - 0
数据加载中……

微软笔试题max subsequence sum

标  题: 微软笔试题max subsequence sum
发信站: 饮水思源 (2005年11月07日11:05:23 星期一)

You are given an array of numbers which could be positive and negative. Please
write down a function to return the max subsequence sum from it.
Note: The sequence could start from any number within the array.
Sample: Array: -1, 7, -2, 5, -3
The max subsequence sum should be 10, by the subsequence 7, -2, 5.
大家讨论一下,有哪些时间复杂度最低的算法。
--

※ 来源:·饮水思源 bbs.sjtu.edu.cn·[FROM: 219.228.107.45]

[回复本文] 发信人: BSR(bsr), 信区: Algorithm
标  题: Re: 微软笔试题max subsequence sum
发信站: 饮水思源 (2005年11月07日12:27:18 星期一), 转信

job 前天讨论过了 
o(n) 即可 


【 在 oceanist (oceanist) 的大作中提到: 】
: You are given an array of numbers which could be positive and negative. Please
:  write down a function to return the max subsequence sum from it.
: Note: The sequence could start from any number within the array.
: Sample: Array: -1, 7, -2, 5, -3
: The max subsequence sum should be 10, by the subsequence 7, -2, 5.
: 大家讨论一下,有哪些时间复杂度最低的算法。

posted on 2005-11-08 22:11 weidagang2046 阅读(915) 评论(1)  编辑  收藏 所属分类: Others

评论

# re: 微软笔试题max subsequence sum[未登录]  回复  更多评论   

O(n)
2008-01-20 10:37 | liu

只有注册用户登录后才能发表评论。


网站导航: