we can use DP to solve this: dp[i][j] = coins[i][j] + max ( dp[i-1][j] , dp[i][j-1] )
On Tue, Dec 14, 2010 at 7:24 PM, divya <sweetdivya....@gmail.com> wrote: > A table composed of N x M cells, each having a certain quantity of > coins. You start from the upper-left corner. At each step you can go > down or right one cell. Find the maximum number of coins you can > collect. > > Provide an algorithm of O(n^2) solution................. > > -- > 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.