To run a coding mock interview with AI, split the job in two: let a voice AI or chatbot play the interviewer (it reads the problem, answers clarifying questions, keeps time and asks follow-ups) while you write the code in a plain editor with a timer, then paste your code in for a review afterwards. A voice-only AI mock hears your explanation but can't watch you type, so narrate your key decisions and treat the code review as a separate step. This is practice: online assessments and live coding rounds set their own rules on outside help, and most don't allow it.
The setup: three tools, three jobs
| Tool | Its job | Settings |
|---|---|---|
| AI interviewer, voice or chat | Reads the problem, answers clarifying questions, keeps time, asks follow-ups | One question at a time; no hints unless you ask |
| Plain text editor | Where you write the code | Autocomplete and linting off; don't run anything until the review |
| Timer | Keeps the round honest | 45 minutes, with a check-in at minute 25 |
| Chatbot review, afterwards | Finds bugs, checks complexity, suggests cleaner code | Paste the problem, your code and the complexity you stated |
For the interviewer, a voice mode such as ChatGPT Voice or Gemini Live makes you talk the way you will on the day; typing your reasoning lets you hide pauses a real interviewer would hear. Interviewers in coding rounds commonly evaluate how you reason, not only whether the code runs, and they can only judge reasoning they hear. Our guide to thinking out loud in coding interviews has a narration template.
What to rehearse: ten problems by pattern
Problems we wrote in widely used patterns, each with the follow-up an interviewer is likely to ask. For the patterns themselves, see our LeetCode patterns for interviews.
| Pattern | Practice problem | Follow-up to expect |
|---|---|---|
| Hash map | Return every pair of numbers in an array that sums to a target, without duplicate pairs | The array is sorted: can you use constant extra space? |
| Sliding window | Length of the longest substring with at most k distinct characters | Characters arrive as a stream |
| Two pointers | Remove duplicates from a sorted array in place and return the new length | Allow each value at most twice |
| Intervals | Merge overlapping intervals | Insert one new interval into an already merged list |
| Heap | Return the k most frequent words | k is close to the number of distinct words |
| Trees | Lowest common ancestor of two nodes in a binary tree | It's a binary search tree; can you do better? |
| Graphs | Given course prerequisites, can every course be finished? | Return one valid order |
| Binary search | Search a rotated sorted array | Duplicates are allowed |
| Dynamic programming | Fewest coins that make an amount | Count the number of ways instead |
| Class design | An LRU cache with get and put in constant time | Each entry now expires after a set time |
A 45-minute coding mock script
| Minutes | Phase | What you say or do |
|---|---|---|
| 0–2 | Problem | Restate it in your own words |
| 2–6 | Clarify | Input size, empty input, duplicates, negative numbers, what to return |
| 6–10 | Approach | A brute force and its complexity, then the better idea and its complexity, before typing |
| 10–30 | Code | Write it in the editor and say the intent of each block |
| 30–36 | Test | Trace a normal case and an edge case by hand; fix bugs out loud |
| 36–42 | Follow-up | The AI changes one constraint; adapt the working code |
| 42–45 | Wrap-up | Final complexity and what you'd improve with more time |
Prompt 1: the interviewer
Be my coding interviewer for a 45-minute practice round at [easy / medium / hard] difficulty on [a pattern, or 'any pattern']. Give me the problem in one short paragraph with one example and nothing else. Answer clarifying questions in one sentence. Don't give hints unless I say 'hint', and count how many I ask for. I'll write code in my own editor and read the important lines aloud. At minute 25, ask where I am. When I say 'done', ask me to trace one input by hand, then give me one follow-up that changes a constraint.
Why it works: it holds back hints and adds a check-in at minute 25, so you practice pacing as well as solving.
Prompt 2: the code review
Problem: [paste]. My code, written in [language] in [minutes] minutes without running it: [paste]. My stated complexity: [time, space]. Review it in this order: 1) would it compile or run as written; 2) any input that gives a wrong answer, with expected and actual output; 3) whether my complexity is right; 4) one edge case I didn't handle; 5) only then, a cleaner version with a one-line reason for each change.
Why it works: the order makes you face your own bugs before you see a better solution.
Prompt 3: tests without the answer
Write 8 test inputs with expected outputs for this problem: [paste]. Include an empty input, a single element, all duplicates, the largest size in the constraints and one tricky case you think I'll miss. Don't show me a solution.
Why it works: you run the tests yourself after the round, and a failing case teaches more than a model answer. Check the expected outputs too; chatbots get some wrong.
A worked example: narrating one problem
What “thinking out loud” sounds like on the intervals problem, line by line. Every claim here is checkable.
- Restate: “I get a list of start and end pairs and return them with overlapping ones merged.”
- Clarify: “Is the input sorted? Do [1,2] and [2,3] count as overlapping? I'll assume touching intervals merge, and an empty list returns an empty list.”
- Approach: “Comparing every pair repeatedly is at least quadratic. If I sort by start, each interval can only overlap the last one I merged, so one pass after sorting works: O(n log n) time, and O(n) space for the output.”
- Code intent: “Sort by start. For each interval, if it starts at or before the end of the last merged interval, extend that end to the larger of the two ends; otherwise append it.”
- Test: “[[1,3],[2,6],[8,10],[15,18]] gives [[1,6],[8,10],[15,18]]. Edge case: [[1,4],[2,3]]. The second sits inside the first, and taking the larger end keeps 4, so the answer is [[1,4]].”
- Follow-up: “To insert one new interval into an already merged, sorted list, I don't need to sort again: copy the intervals that end before it, merge every one that overlaps it, then copy the rest. That's O(n).”
Notice the edge case was chosen to break a common bug: setting the end to the second interval's end instead of the larger of the two.
Rubric for a coding mock
| Criterion | Strong | Weak |
|---|---|---|
| Understanding | Restates the problem and confirms constraints and edge cases | Starts typing straight away |
| Approach | Brute force first, a better idea with reasons, complexity before coding | Codes the first idea with no plan |
| Code | Correct, readable, small helper functions where useful | Works only on the example |
| Testing | Traces cases by hand and finds own bugs | “I think that's right” |
| Communication | Narrates decisions and checks in | Long silences |
| Independence | No hints, or one hint used well | Three or more hints |
| Time | Working code by minute 30, follow-up attempted | Still coding at minute 40 |
Common ways candidates lose points are in our list of coding interview mistakes.
A two-week plan
- Days 1–10: one pattern a day from the table, one 45-minute mock each, reviewed with prompt 2. Redo any problem you needed a hint on two days later.
- Days 11–12: mixed problems, where spotting the pattern is part of the task.
- Day 13: one mock with a person in a shared editor, if your interview uses one; our CoderPad interview tips cover the common platforms.
- Day 14: light review of your notes on missed edge cases, then rest.
Language-specific rounds have their own guides: the Python mock interview and the Java mock interview.
What an AI mock can't do in a coding round
- Watch you type. The AI hears your narration, not your keystrokes. That's why the review is a separate step.
- Share an editor. Real rounds often use a collaborative editor where the interviewer reads along. Practice once in one.
- Be right every time. A chatbot's own solution or test can be wrong. Run its tests and reason about its claims.
- Stand in for an AI-led round. If your screen is run by an AI interviewer, see coding interview with an AI interviewer and take that session yourself.
- Help in assessments. Online assessments and timed take-homes usually forbid outside help. Prepare beforehand.
Where CoPilot Interview fits
CoPilot Interview is an AI interview assistant whose free AI mock interview builds coding questions from your résumé and the job description, reads them aloud and scores each spoken answer out of 10. It scores what you say, which makes it a good drill for explaining an approach and its complexity; keep your editor and a chatbot review for the code itself. The free plan gives 15 minutes a day of live help in sessions of up to 15 minutes, with AI mock interviews included. Online assessments and live rounds set their own rules, so prepare with it and follow your employer's rules.
Disclosure: CoPilot Interview is our product, so weigh what we say about it accordingly.
Frequently asked questions
Can AI run a coding mock interview?
Yes. A chatbot or voice AI can give you problems, answer clarifying questions, keep time and ask follow-ups. Write the code yourself in a plain editor, then paste it back in for a review.
Does a voice AI mock watch me code?
No. A voice-only mock hears what you say, not what you type. Narrate your key decisions, then paste your finished code into a chatbot for a separate review.
How long should a coding mock interview be?
About 45 minutes for one problem with a follow-up, which matches many live coding rounds. Some companies fit two problems into a similar time, so check your company's format.
Should I run my code during practice?
Not during the round if your real interview won't let you. Trace it by hand first, then run it and the test cases afterwards to see what you missed.
How many coding mocks should I do?
There's no fixed number. One a day for two weeks, each reviewed, builds the habits most rounds reward; add at least one with a person.
Rehearse it out loud before the real one
The AI mock interview builds questions from your resume and the job description, reads them aloud and scores each spoken answer out of 10. Included on the free plan.
Start a mock interview