Null Diagonal Check

Write a function zdiag(m) that receives a square matrix of integers m
and checks whether the elements along the main diagonal of m are all
zeros. If they are all zeros indeed, the function must return zero. If
there are nonzeros somewhere in the main diagonal, the function must
return the nonzero value appearing there that has smallest coordinates.

Observation

You can safely assume only that the rows of the matrix are either tuples
or lists, and that the matrix itself is either a tuple of rows or a list
of rows.

Problem information

Author: José Luis Balcázar

Generation: 2026-01-25T15:10:39.534Z

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