Level 2 changes the code you already wrote
You just passed level 1. On the test, this is when level 2 opens: a new statement appears, and every level 1 test keeps running until the 90 minutes are up.
| Working on | Level 1 tests | Level 2 tests | Level 3 tests | Level 4 tests |
|---|---|---|---|---|
| level 1 | run | locked | locked | locked |
| level 2 | run | run | locked | locked |
| level 3 | run | run | run | locked |
| level 4 | run | run | run | run |
Candidates describe exactly this. Each new stage unlocked only once every test of the current one passed, and that forced a refactor (1 report). Backward compatibility seemed to need keeping as the levels went on (2 sources). CodeSignal's own outline puts it in one sentence: "candidates must reuse, encapsulate, and refactor earlier code to maintain backward compatibility." Backward compatibility means every old call still returns what it returned before. OpenAI and Netflix candidates report similar builds in live rounds, key-value stores and caches that expire entries (4 sources).
Here is a small version of that moment. Say level 2 adds one thing to get:
get(key, field, default=None)returnsdefaultwhen the record or the field doesn't exist.
A working level 1 database is in the editor, the same three methods you just wrote. Change the get method so that it also accepts a default, and make sure every level 1 call still gives the same answer as before.