Google | Onsite | Allot people to apartment
Anonymous User
5187

Question

Your organization has hired interns who need to relocate for the summer. You are in charge of assigning apartments to them. Each intern will get their own room. They can choose whether they prefer to share a 2+ room apartment or get a one-bedroom to themselves.
Note that they may not get what they want because the apartments vary in the number of rooms that they have.

You have the following data structures:

public class Apartment {
	public int aptNumber;
	public int numRooms;
}

public class Person {
	public String name; #Unique ID, ex: Sam
	public boolean wants_housemates
}

public Map<Integer, Collection<String>> assignApartmentsToPeople(
    Collection<Apartment> apartments, #List of Apartment
    Collection<Person> people){
	// return apartment to people  map
	}
Comments (14)