Google·Software Engineer·Onsite - System Design / Architecture
- Design an object-oriented model for a dormitory room-assignment system. You have students with room-size preferences (two-person or four-person) and rooms with fixed capacities. Walk through your class design, data structures, assignment logic, and how you handle cases where a student's preference can't be satisfied.
- How would your design change if students could submit a ranked list of room preferences instead of a single choice?
- How would you adapt the system if students register one at a time over a period of time rather than all at once in a batch?
- Suppose groups of friends must be placed in the same room when possible. How does that change your model and what new conflicts can arise?
- How would you make the assignment deterministic and testable so the same input always produces the same output, and what unit tests would you write to verify capacity is never exceeded?
“I jumped straight to writing a Student class and a Room class before figuring out what actually owned the assignment logic.”