@amir: you for loop start from the end of the string so I think it should be
a[i], a[i-1], a[i-2];

On Mon, Jul 12, 2010 at 5:15 PM, Amir hossein Shahriari <
amir.hossein.shahri...@gmail.com> wrote:

> @ashish: i think u meant amir! anyway...
>
> profit for an excellent group is 2 and for a good group it's 1
>
> dp[i] is the max profit for memorizing a[i], a[i+1], ... , a[n]
> dp is initialized to 0
>
> so for example if a[i]==a[i+1]==a[i+2] it means that we can group a[i] &
> a[i+1] & a[i+2] together in an excellent group (+2 profit) so dp[i+3]+2 can
> be a better answer for dp[i]
> the rest of the for loop is just checking these cases
>
> i hope it's clear now
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@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