Ajay Kr. Mishra,
                           well if you don't want the substring and
only interested in subsequence (although I guess the original problem
was to find a substring), then it is a trivial problem.

take all the positive values from sequence (say there are k such
values). If k >= L, then we are good, otherwise include (L - k)
negative values also (of course the ones which have smallest absolute
values).  Since any subset of the elements of sequence will correspond
to a subsequence, so we are fine, and it is easy to see that this is
the maximum sum that can be  achived with at least L elements.

I hope I didnt misunderstood what you wanted to say
Aj

ps: in your code there is no guarntee that the the subsequence has at
least L elements.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to