Given rows * cols matrix. Select cols-1 elements from each row such that that the resulting sum is minimum and each column is selected at least once.
Example:
Input:
[[2, 3, 5],
[3, 2, 5],
[4, 4, 7]]
Output: 20
Explanation:
Select [2, 3] from 1st row
Select [2, 5] from 2nd row (we can't select [3, 2] because otherwise 3rd column won't be selected at all)
Select [4, 4] from 3rd row
So the min sum is 2 + 3 + 2 + 5 + 4 + 4 = 20