Problem 1605 · Medium

Find Valid Matrix Given Row and Column Sums

Build a matrix whose rows and columns match given totals by greedily assigning the smaller of the remaining row and column sums. The visual fills cells and reduces the remaining totals.

Open the interactive visualisation