I have the square matrix with elements, that can take values from {-1, 0, 1}
. I know that there is only 1 element equals to -1 in every row (except the first row, where are only non-negative elements).
Let n be the size of the matrix.
So, I want to assign to every index i
from [2, n]
the position of -1 in i
-th row from matrix.
How can I do this without using a for
or while
loop?