Need help on a problem

Revision en1, by adityagamer, 2023-03-12 02:01:30

Source: Interview

There is grid 'a' of size n*m. There is a guy on cell (1,1) and he wants to reach (n,m). He can move either down or right. Initially, he has health H. If he gets on cell (i,j), then a[i][j] is added to his health. If his health becomes less than or equal to 0, he dies.

Find the minimum value of H so that he can reach the cell (n,m).

I told her binary search but she asked to remove log factor.

How to solve this?

Tags help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English adityagamer 2023-03-12 02:01:30 467 Initial revision (published)