Min-Max Matrix

Given a square matrix MM of n×nn\times n (with n1n\geq 1) of integers, its matrix minMax is the matrix mMmM of n×2n\times 2 such that for all ii (with 0i<n0\leq i<n), mM[i][0]mM[i][0] is the minimum element of the ii-th row of MM and mM[i][1]mM[i][1] is the maximum element of the ii-th column of MM.

For instance, if M=[[1,2,3],[3,1,2],[2,3,1]]M = [[1,2,3], [3,1,2], [2,3,1]], mM=[[1,3],[1,3],[1,3]]mM = [[1,3], [1,3], [1,3]]

Implement the @min_Max(M)@ function that given the square matrix MM returns its minMax matrix.

You can use the @min()@ and @max()@ functions of Python, that given a list, they return their minimum and maximum element respectively.

Sample session

Problem information

Author: Professors Informàtica EEBE

Generation: 2026-01-25T17:41:16.984Z

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