Company: Amazon HackOn
Difficulty: easy
In the land of Eldoria there is a mystical maze represented as a grid with M rows and N columns. Each cell of the grid has an associated energy cost required to traverse it. You are an adventurer starting at the top-left corner of the maze and aiming to reach the bottom-right corner. You begin with a limited energy supply E . Entering a cell (including the starting cell and the destination cell) consumes that cell's energy cost. Determine whether it is possible to reach the bottom-right corner without exhausting your energy supply — that is, whether some route exists whose total cost is at most E . Note: from any cell you may move only down or right , and you may never step outside the grid. Input Format The first line contains an integer M — the number of rows in the grid. The second line contains an integer N — the number of columns in the grid. The third line contains an integer E — the maximum energy available. The next M lines each contain N space-separated