ya nitish above condition will do.... On 7/20/11, Nitish Garg <[email protected]> wrote: > I think: > s[i] = max(s[i-2], s[i-2]+a[i], s[i-1], a[i]) should satisfy all the cases, > even when all the numbers are negative. > Pleas check. > > On Wed, Jul 20, 2011 at 12:44 AM, pnandy <[email protected]> wrote: > >> >> >> On Jul 19, 8:00 pm, ankit sambyal <[email protected]> wrote: >> > @Nitish and Shubam : Since we trying to find sub sequence and not a >> > sub string, so if there are negative nos. in the array, just neglect >> > them. >> > Piyush's algo will work perfectly...... >> >> Piyush's algo won't work for -ve nos. >> Consider an array -12 -10 5.....answer should be 5 while the algo >> gives -7 as the answer. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > >
-- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * <https://www.facebook.com/profile.php?id=100000655377926> "NEVER SAY NEVER" * -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
