Skip to content
Advertisement

Smallest Submatrix in python

It contains an R*C matrix with unique digits. I have to print the submatrix having minimum and maximum integer

JavaScript

This is my code:

JavaScript

I need a solution without a NumPy array.

I found the max and min values and also their index. After that, I don’t know what to do.

Advertisement

Answer

You can iterate over matrix again and get only values in the interval from your found min and max coordinates.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement