I am trying to figure out this problem. I have a matrix with integer values. The goal is to get it so that each row sum and each column sum are non-negative. The only thing I can do is change the characters of the whole row or the whole column.
Here is what I have tried. I am looking for a row or column with a negative sum, and I flip it. This works on all the examples I tried, but now I have to explain why, and I'm not sure. Sometimes, when I do this, the number of negative sums increases, for example, when I turn the line, sometimes worse columns appear after that. But I can not find an example where this does not work, and I do not know how to do it.
source
share