Thursday, September 4, 2014

Monkey Banana Problem


Problem

Idea : Given a diamond shaped 2D array . You have to find out the maximum summation of weight of those cells of which cells form a road to upper cell to lower cell .

To do so , we consider the upper single cell . For this cell , the maximum summation is itself .
For the next two cell , calculate the maximum summation . From which cells , we can visit the cell , we take the maximum of those . Then we do so for next rows . That means , every cell has its maximum summation that is required as above . So , our result is at the last cell .

My Solution

No comments:

Post a Comment