@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 [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