Min-Max Matrix

Given a square matrix MM of integers, with size n×n,n1n\times{n}, n\ge{1}, its matrix minMax is a matrix mMmM with size x×2x\times{2} such that for all i,0ini, 0\le{i}\le{n}, element mM[i][0] is the minimum element of the ii-th row of MM and mM[i][1] is the maximum element of the ii-th column of MM.

For instance, if M is the matrix

1 2 3
6 7 4
8 9 5

then mM will be:

1 8
4 9
5 5

Implement a function minMax(M) that given a square matrix M returns its minMax matrix.

You can use the python min and max functions to compute the maximum and minimum of a list.

Observation

Only the function is expected. Remember to comment out any testing main program you may have.

Problem information

Author: Lluís Padró

Generation: 2026-01-25T20:01:46.469Z

© Jutge.org, 2006–2026.
https://jutge.org