Math, asked by TbiaSamishta, 1 year ago

given a matrix of positive integers/points. we have to start from lower left corner and reach the upper right corner. our path should be such that we fetch maximum points. only two movements are allowed- up and right i.e. from a cell (r c) you can either go to (r c+1) or (r-1 c).

Answers

Answered by aqibkincsem
0

Given a matrix of size N X M consisting of ‘#’, ‘.’ and ‘*’. ‘#’ means blocked path, ‘.’ means walkable path and ‘*’ means point you have to collect. Now consider you are at top left of the matrix.


You have to reach bottom right of the matrix and come back to top left. When you are moving top left to bottom right, you are allowed to walk right or down.


And when you are moving bottom right to top left, you are allowed to walk left or up. The task is find the maximum points you can grab during your whole journey. Points once taken will be converted into ‘.’ i.e walkable path.

Similar questions