How it works
preproom.ai/tracks/ai-assisted-engineering
Checked against the hidden checks
Your run
AI feedback
- How you approached it. You ran the boundary test before you asked for a fix, so you knew what the assistant had to get right.
- How you checked it. You caught the > at the boundary and settled it with a run. Add a test for the refresh rule too.
- The calls you made. You kept the assistant’s put() and rejected its get(). Say why in one line, so a reviewer can follow it.
PassedRoundtrip
put then get
PassedExpiry
a get well past the ttl returns None
PassedBoundary
the entry expires the instant now reaches expiry
PassedRefresh
putting an existing key refreshes the expiry
PassedEviction
a get that finds an expired entry removes it from memory
1# memo_cache.py
2# A tiny TTL cache. The hidden tests drive it through run_ops below.
3#
4# The contract the tests check:
5# - put(key, value) stores value; the entry lives for ttl seconds from now
6# - get(key) returns the value while the entry is live, None once expired
7# - an entry is expired the instant now() reaches its expiry time
8# - putting an existing key refreshes both the value and the expiry
9# - a get that finds an expired entry evicts it from memory
10#
11# Something in here does not hold up the contract. Any model may help.
12
13
14class MemoCache:
15 def __init__(self, ttl_seconds, clock):
16 self.store = {}
17 self.expiry = {}
18 self.ttl = ttl_seconds
19 self.clock = clock
20
21 def put(self, key, value):
22 self.expiry[key] = self.clock() + self.ttl
23 self.store[key] = value
24
25 def get(self, key):
26 if key not in self.store:
27 return None
28 if self.clock() >= self.expiry[key]:
29 del self.store[key]
30 del self.expiry[key]
31 return None
32 return self.store[key]
33
34 def size(self):
35 return len(self.store)
36
37
38def run_ops(ops):
39 # The test driver. Leave it as it is; fix the class above.
40 # Each op is a list:
41 # ["put", key, value] ["get", key] ["tick", seconds] ["size"]
42 # Returns the results of every get and size op, in order. ttl is 10.
43 state = {"now": 0.0}
44 cache = MemoCache(10, lambda: state["now"])
45 out = []
46 for op in ops:
47 if op[0] == "put":
48 cache.put(op[1], op[2])
49 elif op[0] == "get":
50 out.append(cache.get(op[1]))
51 elif op[0] == "tick":
52 state["now"] += op[1]
53 elif op[0] == "size":
54 out.append(cache.size())
55 return out
TestsSample testsAI feedback
Roundtrip put then get[1]
Expiry a get well past the ttl returns None[None]
Boundary the entry expires the instant now reaches expiryThe assistant’s version returned [1] here. Yours returns [None].[None]
| Topicfoundations first | Easy | Medium | Hard |
|---|---|---|---|
| Foundations | |||
| Specs and prompts | |||
| Working with an assistantPracticed | |||
| Core | |||
| Agent design | |||
| Verifying AI outputProficient | |||
| Applied | |||
| Agent evaluation | |||
| Reviewing AI code | |||
| Guardrails | |||
| Advanced | |||
| Rolling out agents | No easy questions | ||
| Judgment and tool fit | |||
| Refactors and migrations | No easy questions | ||
Due for review
Open reviewYour plan
Open the planReviewing AI-written code · Interview Saturday, 14 November
Today
Monday 12
Wednesday 14
Due for review
Open reviewFoundations
Specs and promptsEasyMediumHardWorking with an assistantPracticedEasyMediumHardCore
Agent designEasyMediumHardVerifying AI outputProficientEasyMediumHardApplied
Agent evaluationEasyMediumHardReviewing AI codeEasyMediumHardGuardrailsEasyMediumHardAdvanced
Rolling out agentsEasyMediumHardJudgment and tool fitEasyMediumHardRefactors and migrationsEasyMediumHardOne map for the whole interview.
Follow a path, easier to harder.
Every topic, every question, free to read.
Build with an assistant that gets things wrong.
See where you stand. Come back before it fades.