please helpin implementing this question
A recruiter has decided to take interviews of n attendees with the help of m interviewers at a venue which has r rooms. Each interview takes exactly 2 hours. A day starts from 9:00 am
and ends at 6:00pm with a break from 2:00pm to 3:00pm. Design this system to produce the schedule of the interviews to be taken and also display if some of the interviews cannot be
taken.
. Eg. Input
Attendees: 5
Interviewers: 3(A, B, C)
Rooms: 2
Output
Attendee interviewer room slot
1 A R1 9-11
2 B R2 9-11
3 C R1 11-1
4 B R2 11-1
5 A R1 3-5
Practicing interview questions
Hey @nmaurya760
This is a simple implementation question
3 interviews can take place in one room ,lets fix the timings as 9-11 11-1 and 3-5
Now Give each interviewer one room so max interviews in day can be min(m,r)*3
Assign each interviewer 1 room ,and then assign the candidates ,if some candidate is missed then print its interview cant take place.
Say in above
We had
R1 : 9-11 , 11-1 ,3-4
R2 : 9-11 ,11-1, 3-4
Assign A R1 and B R2
And now assign candidates the slot
1 A R1 9-11
2 A R1 11-1
3 A R1 3-5
4 B R2 11-1
5 B R2 1-3
If number of interviewers are 3 and number of rooms are 2 then how can v assign each interviewer 1 room
That is what I am saying just discard interviewer 3 in that case
But we can’t discard them as u can see the tedt case which i sent u earlier
Ok so let me give u another approach
So ther are r rooms and 3 slots available
So create a RX3 matrrix (1st column for 9-11 ,2nd for 11-1,3rd for 3-5)
Here R=2
so
- - -
- - -
Now Assign interviewers column wise
A C B
B A C
Similarly assign candidates
A1 C3 B5
B2 A4 C-(NO CANDIDATE LEFT)
Also suppose rooms =3 and interviwers are 2 A B
and 7 candidates
So we start with Rx3=3x3
- - -
- - -
- - -
Assign Interviewers
A A A
B B B
- - - (we have to discard room because rooms more than interviwers)
Now assign candidates
A1 A3 A5
B2 B4 B6
7th candidate left
I hope u understood this
This approach gives same output as that of the testcase
I am unable to implement it
Okay let me try
I have one doubt why you have written lines 31-32, we have already checked before if all the candidates are done or not
Because we want to break out of outer loop as well otherwise it may go inside inner loop for next iteration and print unwanted results