Google L3 phone screen

Anonymous User
71
Feb 21, 2025

given two classes Apartments and Persons

class Apratments {

int id,
int no_of_bedrooms

}
class persons{

string name ,
bool want_to share_bedroom

}
A person might want to share bedroom or maynot, we have to assign the bedrooms to each person based on the preferance
do it optimally to assign rooms if not possible maxmize the prefrence as much as possible.
return map<int(aprtmentid), vector(person's name)>allocated.

Comments (0)