A robot walks into a 5*5 grid to collect some points from some of the cells. The objective of the game is to reach one of the end cells or to collect above 2,000 points.

## A robot walks into a 5*5 grid to collect some points from some of the cells

A robot walks into a 5*5 grid to collect some points from some of the cells. The objective of the game is to reach one of the end cells or to collect above 2,000 points.

Of course, like every other game, you will lose if your points fall under a certain range.

Starting at the start cell (x=0, y=0), the goal is to keep moving in the grid and collecting points until one of the following conditions is satisfied:

1. The number of the steps/iterations exceeds 20

2. Your total score falls under -1,000

3. Your total score exceeds 2,000

4. The robot reaches one of the end locations (x=4, y=4) OR (x=4, y=0).

More details;

### Unique paths in a Grid with Obstacles

Given a grid of size m * n, let us assume you are starting at (1, 1) and your goal is to reach (m, n). At any instance, if you are on (x, y), you can either go to (x, y + 1) or (x + 1, y).

Now consider if some obstacles are add ed to the grids. How many unique paths would there be?

An obstacle and empty space are marked as 1 and 0 respectively in the grid.

We have discussed a problem to count the number of unique paths in a Grid when no obstacle was present in the grid. But here the situation is quite different. While moving through the grid, we can get some obstacles which we can not jump and that way to reach the bottom right corner is blocked.

The most efficient solution to this problem can be achieved using dynamic programming. Like every dynamic problem concept, we will not recompute the subproblems. A temporary 2D matrix will be constructed and value will be stored using the bottom up approach.