Question: in python 3 write an algo which finds out the elements which are largest in a row and smallest in a column in a matrix.

in python 3

write an algo which finds out the elements which are largest in a row and smallest in a column in a matrix.

INPUT:

the first line of input consists of 2 space-separated integers-matrix_row and matrix_col, representing the number of rows in the matrix (N) and the number of columns in the matrix (M), repestively. the next M lines consists of N space-speparated integers representing the elements of the matrix.

OUTPUT:

print a number which is largest in a row and smallest in a column in given matrix. if no element is found print -1

EXAMPLE:

input:

2 2

1 2

3 4

output: 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!