AI-Assisted Coding Interviews: Directing, Checking and Owning the Code
This lesson is for software and data candidates who may face a coding interview where an AI assistant is allowed, or even expected. The format is new and still changing: some large tech companies have started running versions of it, and the rules differ from one company to the next. What stays constant is what the interviewer is watching. They are not grading the assistant. They are grading how you break down the problem, direct the tool, check its output and take responsibility for the result.
How the format usually runs
Details vary, so ask the recruiter what to expect. Common shapes:
A larger, more realistic task. Instead of one algorithm puzzle, you may get a small codebase and a feature to add, a bug to fix, or a module to extend. Reading unfamiliar code becomes part of the test.
An assistant in the editor or in a side chat. You can ask it to explain code, draft functions, write tests or suggest fixes.
The interviewer watching the whole session. Your prompts, what you accept, what you reject and what you run are all visible. Talking through your choices matters as much as in a classic round.
Some companies allow the assistant for the whole session; others allow it only after you have explained your approach. If the rules are not stated, ask at the start: "Am I free to use the assistant for any part of this, and is there anything you would like me to do without it?"
What interviewers evaluate
The skills are the ones a strong engineer uses with these tools every day:
Problem decomposition. Do you understand the task well enough to split it into steps small enough to ask for, and to know what "done" means for each?
Directing the assistant. Do your prompts give the context, the constraints and the exact interface you want, or do they say "write the function" and hope?
Verification. Do you read the output before running it, test the edge cases, and catch the bug the assistant introduced? This is usually where candidates are separated.
Reading unfamiliar code. Can you find your way around the existing files, follow the data, and explain what a piece of code does?
Judgment and ownership. Do you reject a suggestion that is wrong, overcomplicated or inconsistent with the codebase? Would you put your name on the final code?
Communication. Does the interviewer always know what you are doing and why?
The classic coding skills from the coding quick start still apply. The assistant speeds up typing; it does not replace thinking about correctness and complexity.
A workflow that works
Understand the task yourself first. Read the relevant code, restate the goal, and ask the interviewer your clarifying questions. Do not hand the assistant a problem you have not understood; you will not be able to judge its answer.
Plan out loud. Name the steps, the functions you will add or change, and how you will test them. One or two minutes is enough.
Prompt for one small step at a time. Give the types or signatures involved, the rules you clarified, and what to avoid. Small requests produce output you can actually review.
Read every line before running it. Explain it to the interviewer as you go. Look for boundary conditions, mutated inputs, unhandled empty cases and invented helper functions that do not exist in the codebase.
Verify with tests you chose. Decide the edge cases yourself, then run them. If the assistant writes tests, check that they test the rules you agreed, not the assistant's own assumptions.
Integrate and repeat. Fit the piece into the code, rerun, and move to the next step.
Close with what you would still check. Performance on large inputs, error handling, a case you did not have time to test.
Tip
Keep a short running list of the rules you clarified with the interviewer. Paste the relevant ones into each prompt. Most wrong output comes from the assistant guessing a rule you already settled.
Worked example: top customers by spend
Task: an existing module stores orders as { customerId, amountCents, placedAt }. Add a function that returns the ids of the n customers who spent the most within a date range.
The weak session
The candidate types "write a function that returns the top n customers by spend in a date range", pastes the result, runs the one example in the task, sees it pass and says they are done. The code the assistant produced:
function topCustomers(orders: Order[], from: Date, to: Date, n: number): string[] {
const totals = new Map<string, number>();
for (const order of orders) {
if (order.placedAt > from && order.placedAt < to) {
totals.set(order.customerId, (totals.get(order.customerId) ?? 0) + order.amountCents);
}
}
return [...totals.entries()]
.sort((a, b) => b[1] - a[1])
.slice(0, n)
.map(([customerId]) => customerId);
}It looks reasonable, and it hides two problems. The strict comparisons drop orders placed exactly at from or to. And customers with equal totals come back in whatever order they first appeared, so two runs over the same orders in a different order can return different answers. The candidate never asked whether the range was inclusive, never tested a boundary, and could not say what the function does with ties. On verification and ownership, this session scores low even though the code runs.
The strong session
The candidate first reads the Order type and asks the interviewer three questions: is the date range inclusive at both ends, how should ties be ordered, and can amounts be negative (refunds)? The answers: inclusive, ties by customer id ascending, and refunds count as negative amounts.
Then they prompt with those rules and the exact signature:
"Write
topCustomers(orders: Order[], from: Date, to: Date, n: number): string[]. Include orders with placedAt between from and to, inclusive at both ends. Sum amountCents per customer; amounts can be negative. Return the ids of the n highest totals, ties broken by customerId ascending. Do not mutate the input. If n exceeds the number of customers, return them all."
Reading the output, they explain each line and check it against the list. The draft uses >= and <= this time, but the sort has no tie-break, so they fix the comparator themselves:
.sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))Then they name their tests before running anything: an order exactly at from, one exactly at to, two customers tied, a refund that drops a customer below another, n larger than the number of customers, n of 0 and an empty order list. On the weak session's code, the tests at from and at to both fail; on this session's first draft, the tie test fails whenever the customer with the later id appears first in the input. Finally they state the complexity: one pass over m orders, then sorting k customers, so O(m + k log k), and they mention that a size-n heap would make it O(m + k log n) if there were millions of customers and n was small.
The code in the two sessions is almost the same. The scores are not, because the second candidate showed they understood the rules, controlled the tool and checked the result.
Follow-ups to expect
Interviewers in this format probe your ownership of the code more than the code itself. Expect questions like these, each with what a strong answer does:
"Why did you accept that line?" Explain what it does and which rule it satisfies. "The assistant wrote it" is the answer that costs the most.
"What would you have tested next?" Name the case and the bug it would catch, such as an order placed in the afternoon of the last day when
toarrives as midnight of that day, which even the inclusive comparison drops."Do this next part without the assistant." Some interviewers switch it off for a step to check your fundamentals. Treat it as a classic coding question: plan, code, test.
"The assistant suggested X; why didn't you use it?" Give the concrete reason, such as a duplicated helper, a hidden O(n²) or a rule it ignored.
What changes with seniority
Earlier-career candidates are expected to use the assistant safely: understand what it wrote, test it and fix its mistakes.
Mid-level candidates should also steer the structure: reject a draft that duplicates an existing helper, fits badly with the codebase's patterns or adds needless complexity.
Senior candidates are expected to make the design calls themselves (where the code belongs, what the interface is, what to leave out) and use the assistant for the mechanical parts. Explaining which parts they would never delegate is a strong signal.
Mistakes that cost points
Outsourcing the understanding. Prompting before you know what the code must do means you cannot tell a right answer from a wrong one.
Accepting code you cannot explain. If the interviewer points at a line and you cannot say why it is there, it counts against you, whoever wrote it.
One giant prompt. Asking for the whole feature at once produces too much to review. Ask in steps.
Trusting generated tests. Tests written from the same misunderstanding pass on the same bug. Choose the edge cases yourself.
Going silent while the tool works. Narrate what you asked for and what you expect back, just as you would narrate your own code.
Fighting the tool. If three prompts have not produced a five-line fix, write the five lines yourself and say why.
Practice it
SmartIntervu's coding interviews do not include an AI assistant, but they train exactly the skills this format grades: clarifying the rules, planning out loud, reading code critically and testing edge cases on purpose. Practice those there.
Take 15 minutes with this drill: write a short function, or take one from a codebase you know, and review it as if an assistant had produced it. List every boundary, empty case and input mutation you can find, write the tests before running them, and explain each line out loud.
Then start Design an LRU Cache and hold yourself to the strong-session habits: ask the clarifying questions first, plan the steps aloud, and name your test cases before you run anything.
Practise this in a mock interview
Try what this lesson covers out loud: the AI interviewer asks one of these questions, follows up, and scores your answer.
- Two SumCoding · Easy
- Design an LRU CacheCoding · Medium
- Deploy Services in Dependency WavesCoding · Medium
- Flag Overlapping Maintenance WindowsCoding · Medium
Read next
- Coding Interviews: A Repeatable Approach
Run one five-step method with a 45-minute time budget on any coding problem, pick the target complexity from the constraints, and narrate, test and use hints in the way the report scores.
8 min read
- Two Pointers
Recognize when sorted input, in-place edits or a linked list call for two pointers, then apply the opposite-ends, reader-writer and fast-slow shapes and say why each pointer move is safe.
8 min read
- Sliding Window
Spot contiguous-range problems, run fixed and variable windows from one template, decide where to record the answer, and explain why the window breaks once values can be negative.
8 min read
- Binary Search
Write one boundary-search template without off-by-one bugs, derive exact, first, last and count searches from it, and binary search on the answer and on rotated arrays.
9 min read
