Google L3 phone screen

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2025-02-21Added By Anonymous
Source: Link
🧭 Experience: unknown
✅ Outcome: unknown
💰 Compensation: unknown
📍 Location: unknown
🏢 Company: Google
🎓 Education: unknown
🎁 Benefits: unknown
📅 Offer Date: unknown

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<string>(person's name)>allocated.
Comments