Let $M$ be an $n\times n$ matrix whose entries are $+$ and $-$. Call $M$ nice if it is possible to make it all $+$ by a set of operation, each consisting of changing the sign of one row or the sign of one column.
Design a simple and efficient algorithm for deciding whether the given M is nice.
For starts, I think that the the number of $+$ must be a multiple of $n$ (i.e: $ 0, n, 2n,...,n*n $). But i am not sure how to prove/continue, I would be happy for some help.
Therefore, a simple algorithm is to check if each row is equal or opposite to the first row.
Proof: Suppose every row is either equal or opposite to the first row. Flip all rows which are opposite the first row, so now all rows are the same. Then, flip all negative columns.
Suppose $M$ is nice. Then there is a sequence of flips starting from the matrix $P$ whose entries are all $+$ and ending at $M$. Note $P$ has the property that every row is equal or opposite the first. Furthermore, flipping any row or column preserves this property. Therefore, $M$ has the property as well.