[algogeeks] Re: Find largest sum

2007-08-24 Thread ilija
I would like to see your code for the first case. I really doubt that there exists an O(n) algo for this. On 23 kol, 16:11, "Lego Haryanto" <[EMAIL PROTECTED]> wrote: > Either case is O(n), in fact. > > On 8/23/07, ilija <[EMAIL PROTECTED]> wrote: > > > &g

[algogeeks] Re: Find largest sum

2007-08-23 Thread ilija
If the subarray needs to be continuous, then you can do it using DP. If it doesn't, you can do it using an O(n) algo - simply sum all the positive integers. On 22 kol, 19:55, Ravi <[EMAIL PROTECTED]> wrote: > You're given an array containing both positive and negative integers > and required to f