suppose i got a matrix

0 1 0 0 2

0 0 0 4 0

5 0 2 1 3

4 4 5 0 0

0 3 2 0 2

Select a matching by choosing a set of zeros so that each row or column has only one selected. It means that i should have only one zero selected from each row and column!

i implemented several of my logics in mind but there comes a problem in every one! kindly help me! my project is badly stuck at this point just because of this stupid step!

i have to make a new matrix 2d in which the zeros from rows and columns should be selected in a way that they are unique!!

like in this case output should be

1 0 0 0 0

0 0 1 0 0

0 1 0 0 0

0 0 0 0 1

0 0 0 1 0