There are M objects of type 1 and N objects of Type 2. Given Cost[i][j] where i is an object of Type 1, and j is an object of Type 2. What is the minimum total cost achievable after every type 1 object is mapped with exactly one type 2 object? Total cost is defined as the summation of the individual costs incurred due to matching.
M <= N.
Example : Type 1 : A B Type 2 : C D cost[A][C] = 100 cost[A][D] = 10 cost[B][C] = 10 cost[B][D] = 100.
It's optimal to match (A, D) and (B, C), the total cost incurred is 20.
I thought of a bit masking + DP approach, but the complexity is exponential, is there a better approach?