Problem Statement:

Mustafa wants to cross a dungeon. The dungeon has N cells, and in every cell, there are M monsters. To cross each cell he has to kill one monster, on killing the monster, he loses the strength equal to that of the monster and gains some confidence which adds up to his strength and he proceeds to the next cell. Mustafa can only kill a monster if his strength is greater than or equal to the strength of the monster. Help him find the minimum strength he must have in the beginning so that he can cross N cells.

Input format:

• First two integers are N and M.
• N X M matrix represents the energy required to kill the monster in each cell.
• N X M matrix that represents confidence gained by killing respective monsters.

Testcase:

Input:

```3 3
3 2 5
8 9 1
4 7 6
1 1 1
1 1 1
1 1 1
```

Output:

`5`

Can someone tell me I can solve this with  Dynamic programming?

May 26, 2022 in Python 1,894 views

## In a list of dictionaries, how can I find the minimum calue in a common dictionary field.

There are several options. Here is a ...READ MORE

## How can I find out the index of an element from row and column in Python?

You probably want to use np.ravel_multi_index: [code] import numpy ...READ MORE

## Can someone explain the behaviour of increment and decrement operators in python

down voteaccepted ++ is not an operator. It is ...READ MORE

## How can I find the square of a number in python?

You can use the exponentiation operator or ...READ MORE

## How can I raise an exception in Python so that it can later be caught via an except block?

It's pretty simple to raise a query  raise ...READ MORE

## How can I find the files and skip the directories using os.listdir in python?

When I am using os.listdir I am ...READ MORE

## Competitive Programming Algorithm Sock Drawing Probability Question

Another way to look at the problem ...READ MORE