Maximum Bipartite Matching
Submissions: 658   Accuracy:

26.63%

  Difficulty: Easy   Marks: 2

There are M job applicants and N jobs. Each applicant has a subset of jobs that he/she is interseted in. Each job opening can only accept one applicant and a job applicant can be appointed for only one job. Find an assignment of jobs to applicant in such that as many applicants as possible get jobs.

Input:
First line consists of test case T. First line of every test case consists of two integers M and N. Second line of every test case consists of M*N spaced bool values(0 and 1).

Output:
Returns a integer value, denoting the  number of applicants can get the job.

Constraints:
1<=T<=100
1<=M,N<=10

Example:
Input:

1
6 6
0 1 1 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Output:
5

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth
Author: saksham seth


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.