In this question can someone tell me how should we approach it I cant understand what would be the solution to this question
Gym at coding blocks
Can you provide Qn link as well ?
https://online.codingblocks.com/player/2504/content/914
couldn’t find it on hacker block though it was in the interview prep course in dp section :
Question is as follows :
GYM IN CODING BLOCKS
Recently, a gym was open in coding blocks and Prateek Bhaiya and Arnav Bhaiya decided to workout. There are n x m cells in gym and every cell has a workout value associated to it.
- Prateek Bhaiya started working out from the cell (1,1) and has to reach cell (n,m) moving only right or bottom.
- Arnav Bhaiya started working out from the cell (n,1) and has to reach cell (1,m) moving only right or up.
However they can only move in such a way that a cell used by one person can never be used by another person , except for one cell where they must meet and they DO NOT workout in that cell. They just talk about the courses in the Coding Blocks and how to improve them.
Find out the the maximum possible value of workout that can be done by Prateek Bhaiya and Arnav Bhaiya, combined, satisfying the above constraints.
Input Format:
The first line of the input contains two integers n and m . Each of the next n lines contains m integers: j-th number from I-th line denotes element a[i][j] .a[i][j] is the workout value associated with that cell of the gym.