didn't get you, how to check for subsequences which doesn't start from the
beginning ? can you explain for that same example... should we check for
all contiguous subsequences of some particular length?


On Tue, Feb 21, 2012 at 11:15 PM, sunny agrawal <sunny816.i...@gmail.com>wrote:

> i dont know if a better solution exists
> but here is one with complexity O(N*logS)...
> N = no of elements in array
> S = max sum of a subarray that is sum of all the elements as all are
> positive
>
> algo goes as follows
> do a binary search in range 0-S, for each such candidate sum find how many
> sums are smaller than candidate sum
>
> there is also need to take care of some cases when there are exactly k-1
> sums less than candidate sum, but there is no contigious where sum =
> candidate sum.
>
>
> On Tue, Feb 21, 2012 at 11:02 PM, shady <sinv...@gmail.com> wrote:
>
>> Problem link <http://www.spoj.pl/ABACUS12/status/ABA12E/>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Sunny Aggrawal
> B.Tech. V year,CSI
> Indian Institute Of Technology,Roorkee
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to