I think your solution will take O(n3) time , as it will require three
loops . 1st for index i , 2nd for first max and 3rd for second max .
Instead we should take :
dp[i] = max(dp[j]) + p[i] , where j<i and m[i] - m[j] > k . Pls
correct me if something is wrong .

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