Input: A 2-dimensional NxN
-symmetric Matrix - with NxN
positive elements.
Output: A 2-dimensional matrix of NxN
size with N
selected elements such that its summation is the maximum among all possible selection. Other elements that are not selected are zero. In other words, we should select N
elements from matrix to return maximum sum.
Requirement: If the dimension of matrix is 4*4
, we should select 4 integer. Every row and column in matrix should not be used more than 2 times.
For example if we have 4*4
matrix, the following element could be selected:
(1,2)
(2,3)
(3,4)
(4,1)
but if we select (1,2)
and (4,1)
, we cannot select (1,3)
, because we used 1
two times.
IS there an efficient algorithm for this problem?