Skip to the guide

Follow-up drills: "add a new type", "make it thread-safe", "now save it to disk"

MixedDrills11 pages

A new requirement comes up in most LLD rounds, during the deep dives. What the LLD round scores pictures it as the extra shelf the master asks for. A well-made cabinet takes that shelf on pegs that are already there. This page holds ten drills for that moment. Each one takes a case study you have read, states one change in the interviewer's words, and asks what changes, what stays, and which count decides it. The drills are grouped by the kind of change, because each kind has its own first move. When the interviewer adds a requirement halfway through teaches the general moves that every kind uses.

How to use this page. Give each drill 10 minutes. Spend a minute rereading the case study's class diagram and its sizes, because the drill doesn't repeat them. Then spend about five minutes on paper: redraw the classes with the change on them, find the class that owns it, and name each file you would touch. Say your answer out loud in about two minutes, in the round's order. Open the hint only if you are still stuck after five minutes, then open Check your answer. The model answers are short on purpose, because a new requirement gets one or two minutes in a real round. The list under "A strong answer covers" is what the interviewer would tick.

Add a new type or rule

Before you type, say where the change lands and name the files it touches (Extend it, test it and handle the edge cases). It lands as new data, as a new class behind an interface you already have (Open/closed), or as an edit to a core method that you justify out loud.