Some time back , I had interviewed for Google . I was presented with the following question :
You are given a list of people and their preference to have a flatmate or not .
Next you are given list of flats along with their number of rooms .
How will you assign the flats to people if you can override their choice of having a flatmate or not as we want to priortise everyone having having a flat .
The interview said there is no right or wrong answer , he wants to see my approach .
The solution I presented was :
Let's sort the people who want flatmate first and the apartments in order of more rooms and then assign accordingly .
I would like to know what would have been the better approach here ?
Comments (0)


