Won't this recurrence work:
s[i] = max(s[i-2], s[i-2]+a[i], a[i-1]) work?
I think it works.

On Tue, Jul 19, 2011 at 4:54 PM, oppilas . <[email protected]>wrote:

> New constraint:-
> What if the array also contains positive and negative numbers?
>
> On Tue, Jul 19, 2011 at 4:36 PM, sagar pareek <[email protected]>wrote:
>
>> ok ok ok thank you all
>>
>>
>> On Tue, Jul 19, 2011 at 4:35 PM, ankit sambyal <[email protected]>wrote:
>>
>>> @Sagar: 13 is the correct answer. (6+4+3)
>>>
>>> --
>>> 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.
>>>
>>>
>>
>>
>> --
>> Regards
>> SAGAR PAREEK
>> COMPUTER SCIENCE AND ENGINEERING
>> NIT ALLAHABAD
>>
>> --
>> 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.
>

-- 
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.

Reply via email to