AI Interviews · Question

AI-assisted coding round with a built-in assistant. Reports: finish a buggy, half-built maze class so every maze has a start-to-finish path; an LRU cache extended with TTL and then thread safety. The AI is framed as help with implementation; expect to justify the approach you pick and say how you would test each change.

AI-assisted coding question reported at LinkedIn (Aug 2026). Sources, confidence and an answer card.

Researched · updated

r2a-019 Both tracks AI-assisted coding rounds AI-assisted coding Senior Medium confidence
On this page

What they’re really asking

If you only remember one thing, say this in the first minute: “I’ll choose the approach myself and say why before I ask the assistant for anything. I’ll write down the invariants the code must keep, type the core myself, and use the assistant for scaffolding and tests. I check its output against those invariants and a randomized test, not by rereading every line. When I accept one of its suggestions, I’ll say why, and for each change I’ll say how I’d test it.”

The rest of this page explains each part of that answer.

The interviewer wants to know whether you stay the author of the solution while an assistant helps you type it.

In a normal coding round, everything on the screen came from you, so the interviewer reads your code to judge your thinking. In an AI-assisted round you may use a chat assistant built on a large language model (LLM), the kind of model behind ChatGPT or Claude. The assistant can produce 80 plausible lines in seconds, so output volume says nothing about you. What the interviewer watches instead is judgment: did you pick the approach, can you defend it, and did you catch the assistant’s mistakes before they cost you time?

Two reports show the shape. A Senior (L5) candidate was asked to “Use the AI assistant to debug and complete this maze implementation”, then asked why they chose the AI’s approach and what they would change for production (Aced (formerly Exponent)first-hand · 2026). A second candidate, at LinkedIn, got staged tasks building a least-recently-used (LRU) cache and was told “I had to come up with the algorithm myself” (PracHubfirst-hand · Aug 2026). Both were rejected.

Words you need first

  • An invariant is a fact the code must keep true after every operation. For an LRU cache: “the map and the list hold the same keys, with no duplicates, and never more than the capacity.”
  • An oracle is a slow, simple implementation you already trust. A randomized oracle test runs the same random operations on your code and the oracle and compares them after every step.
  • LRU (least recently used): a cache that evicts the entry unused for longest, built from a hash map and a doubly linked list.

Clarify first

Spend one minute pinning down the rules of the round. Say your assumptions out loud:

  • Can the assistant edit the code, or only chat? Hello Interview says LinkedIn’s “can’t directly modify your code” (Hello Interviewsecondary · 2026). “Can the assistant edit my file, or only answer in chat?”
  • How many parts, and is the score the number completed? The LRU candidate’s relayed feedback was the count: four tasks, two finished. “How many parts are there? I want to pace myself.”
  • For the maze: what does “valid” mean? “Is it valid if there’s at least one path from start to finish, or must there be exactly one? How is the grid stored, and how are walls represented?”
  • Which language and test harness are available? “Can I run tests as I go?”

Answer

Decide the approach yourself, out loud, before asking the assistant anything

For the maze, the Senior candidate picked “a simpler tree-traversal-style one because it was easier to reason about” (Aced (formerly Exponent)first-hand · 2026). Here is the argument behind that choice. A generator that builds a spanning tree over the cells (a set of passages that connects every cell with no loops), for example a randomized depth-first search, guarantees exactly one path between any two cells. “Every maze has a path” then holds by construction instead of being checked afterwards. Say: “I chose the tree-based generator because correctness comes from its structure, so there’s less to check.”

For the LRU, state the map-plus-list structure and the invariants before any code exists.

Follow one task through the round

The LRU task, done the way the reports suggest:

MinuteWhat you doWhat to say in the interview
0–2Say the structure and write the invariants as a comment.”Map for lookup, list for order. Map size equals list length, never above capacity.”
2–4Ask the assistant for the invariant check and the oracle test below.”I’ll get the test first. It’s easy to check by reading, and it catches the bugs I care about.”
4–14Type the cache yourself.”The core is short. Reviewing a generated version would take me longer than typing it.”
14–16Run the oracle test. A missing map delete fails on the first eviction.”The test reviews the code for me.”
16+Next task. Use the assistant for boilerplate such as a fake clock.”Bounded jobs with an easy check go to the assistant.”

Use the assistant for scaffolding and tests, and type the core yourself

The LRU candidate describes a loop: the assistant generates a section, they review it line by line, then ask for fixes. They found it slower than typing. The bugs they report are a missing map delete on eviction, invented variables, and later code that didn’t match earlier code (PracHubfirst-hand · Aug 2026). You cut review time by checking against invariants instead of reading every line. These two functions do that check:

def check_invariants(c):
    keys = c.keys_lru_to_mru()
    assert len(keys) == len(set(keys)) == len(c.map) <= c.cap   # no ghosts, no duplicates
    assert set(keys) == set(c.map)

def test_random_ops_match_oracle():
    rng = random.Random(7)
    for _ in range(200):
        cap = rng.randint(1, 6)
        c, oracle = LRUCache(cap), OrderedDict()
        for _ in range(300):
            k = rng.randint(0, 9)
            if rng.random() < 0.5:
                assert c.get(k) == oracle.get(k)
                if k in oracle: oracle.move_to_end(k)
            else:
                c.put(k, k); oracle[k] = k; oracle.move_to_end(k)
                if len(oracle) > cap: oracle.popitem(last=False)
            assert c.keys_lru_to_mru() == list(oracle)

Ask the assistant for this test first. A ghost key (a key left in the map after its node was evicted from the list) fails on the first eviction. For the maze, the matching check is a breadth-first search from the start that must reach the finish on 1,000 generated mazes.

Say how you’d test each change

Interviewers asked that in the maze report. Then they moved to production concerns: service boundaries, concurrency, splitting the system up (Aced (formerly Exponent)first-hand · 2026). Have a sentence ready for each change:

  • Expiry: “I pass the cache a clock, so the test moves time instead of sleeping.”
  • Threads: “One lock, because get reorders the list, so it writes.”
  • Under load: “A stress test from several threads, then the invariant check.”

Senior vs Staff

AI-assisted staged round

Senior

  • Owns the algorithm, finishes the stages with tests, and catches the assistant's bugs with invariants rather than rereading.

Staff

  • Sets the pace deliberately (types the core, delegates scaffolding), explains each AI suggestion accepted or rejected, and takes the production follow-ups to boundaries and failure modes.

In plain terms: a Senior candidate gets through the stages with tests and catches the assistant’s bugs. A Staff candidate also decides what to hand to the assistant and what to type, explains every accepted suggestion, and moves easily into production questions.

Small-team version

This is how a small team’s AI owner works every day. A coding agent (an assistant that can edit files and run commands) writes the draft; you write the invariants and the test that would catch the plausible bug. Three rules carry over:

  • Write the check before the code. An invariant check and an oracle test cost minutes and catch whole classes of generated bugs.
  • If reviewing the agent’s code takes longer than writing it, write it yourself. Give the agent the tests and boilerplate instead.
  • Never accept an approach you can’t defend. If you can’t say why it’s right, you can’t maintain it.

Say: “I treat generated code like a pull request from a fast new hire: I own the design and the tests.”

Pitfalls

  • Asking the assistant to “implement an LRU cache with TTL”. You then review 80 lines under time pressure instead of typing 30.
  • Accepting an approach you can’t defend. The maze interviewers asked exactly why the AI’s approach was chosen.
  • Never running the code until the end. Bugs pile up and the last ten minutes go to debugging.
  • Treating the first task as the whole interview. Hello Interview warns against exactly this (Hello Interviewsecondary · 2026).

Go deeper

Family