I found this question on a forum chat on and while looking at it I thought I can solve it using recursion,
A group of friends is split into cells in a room in a random arrangement of m X n cell locations in a rectangular or square form, such that each person in a cell can see all the people in their cell as well as the people in all the cells at the higher or equal position in row or column number. You are required to find out how many persons can be seen by each cell player from their respective cells i.e. you have to print the view matrix. persons in cell [i,j] can see all the players in cell [a,b], where a = i to m and b = j to n.
Let there is a matrix= \begin{bmatrix}1&1&1\\1&1&1\\1&1&1\end{bmatrix} The output must be =\begin{bmatrix}9&6&3\\6&4&2\\3&2&1\end{bmatrix}
After hours of thinking about it, I realized that this question can be done using dynamic programming, I don't know enough about dynamic programming, after few tutorials from the internet, I am confused, Can anyone refer me a very exact question like this on the Internet,I am unable to find a question like this, I wish to learn about this topic by doing this question. Otherwise,you can also tell me how questions like this are done. I will keep editing as I understand how to do this question. Thanks.
Few resources that helped me that it is dynamic programming question:
What is dynamic programming about? When can I use dynamic programming to reduce the time complexity of my recursive algorithm?