Part 5 of 7 · 1 min read
Code or sketch
Spend lines where they score.
A round has no time for everything. A made-up guide for 15 minutes of coding:
| Write in full | Write as a signature and a comment |
|---|---|
The main flow (book, cancel) |
Getters and setters |
| The central rule (overlap) | Persistence, logging, printing |
| One extension point (the interface) | Other implementations of that interface |
| Constructors that validate | Boilerplate such as toString |
Say what the signature stands for: "findFreeRooms loops over rooms and uses the same overlap check. I will skip the body to leave time for the lock." That sentence earns credit, and silence does not.
Use plain Java. Avoid frameworks, annotations and libraries unless the interviewer asks. Use the standard collections: List, Map, Set, Deque. Prefer Map lookups over loops when a lookup is needed, and say why.
Check yourself: 1. Which two things must be written in full? 2. What do you say when you skip a body? 3. Why avoid frameworks in a round?