Graded in a sandbox
Test code not shown · 30 min suggested
Implement an LRU cache
Keep what was just used. Drop what went quiet.
5 of 6 required tests passed
How to read this: the verdict comes from the required tests. The counts below describe how the code was written. Nothing here shows who typed it. Iterations are the times the tests were run. Versions are distinct versions of the code the tests ran on. Span is the time from first run to save.
- Required tests
- 5 of 6
- passed
- Bonus
- 1 of 2
- passed
- Iterations
- 3
- graded runs
- Versions
- 3
- distinct versions graded
- Span
- 3 min
- first run to save
- Runtime
- 444 ms
- in the sandbox
- Saved
- Nov 10, 2026
How the code arrived
- Run 1, 0s after the first run: added 63 bytes, failed a required test.
- Run 2, 1 min 12s after the first run: added 197 bytes, failed a required test.
- Run 3, 2 min 36s after the first run: added 91 bytes, failed a required test.
- First graded run
- Did not pass every required test.
- Largest single jump
- 197 bytes added between two graded runs, counting from the starter code.
Tests
- PASSstores and returns values
Questions to ask in the interview
Questions that start with a line number point at the submitted code. The others come from this Challenge and the counts above. Each one asks the candidate to explain the code in their own words.
- Line 4: why this data structure rather than a plain object or array?
- Which structure did you choose to track recency, and what does a get cost?
- Why does get count as a use?
- What does put do when the key already exists and the cache is full?
- How would you change this to expire entries after a set time?
- Some required tests did not pass. Which would you fix first, and why?