Home · Blog · Technical and coding
How to pass a coding interview (a step-by-step plan)
Passing a coding interview is less about knowing every algorithm and more about a reliable process, practised until it feels normal. This guide explains what interviewers actually score, how to prepare in six weeks and what to do on the day.

In short
- Interviewers score problem solving, code quality, communication and testing, not only whether you finish.
- Learn about fifteen patterns well instead of hundreds of problems once.
- Practise in interview conditions - out loud, timed, in a plain editor.
- On the day, clarify, plan, code simply, test, and only then optimise.
Practise this free: a mock interview for Coding round (algorithms), scored, with a stronger answer. 3 a month, no card.
Start a mock interviewCoding interviews have a reputation for being a lottery: get a problem you’ve seen and you pass, get one you haven’t and you fail. In practice, the candidates who pass consistently have a process they trust, and they’ve practised it until they can use it under pressure.
What interviewers score
Most companies use a written scorecard with four or five areas. The names vary, but they usually come down to:
- Problem solving. Did you understand the problem, find a reasonable approach and improve it?
- Code. Is it correct, readable and organised? Would you be happy to review it at work?
- Communication. Could the interviewer follow your thinking? Did you respond to hints?
- Testing. Did you check your code and find your own bugs?
- Speed. Did you get far enough in the time?
Notice that only one of those is “the answer”. A candidate who explains well, writes clean code and tests it can pass with a slightly slower solution. A candidate who silently types the optimal answer often scores lower than they expect.
A six-week preparation plan
Adjust it to the time you have, but keep the order.
Week 1: fundamentals. Review arrays, strings, hash maps, stacks, queues and complexity. Our guide to big O notation and the overview of data structures to know cover what you need.
Weeks 2 to 4: patterns. Work through the common patterns, a few problems each: two pointers, sliding window, binary search, BFS and DFS on trees and graphs, heaps, backtracking, intervals and basic dynamic programming. Our LeetCode study plan gives you an order.
Week 5: interview conditions. Solve problems out loud, in a plain editor, with a 35-minute timer. Do at least three mock interviews with a person or a tool.
Week 6: review and rest. Redo problems you struggled with, read your notes and stop learning new topics two days before. Sleep matters more than one more problem.
How to practise so it sticks
- Spend 20 to 30 minutes before looking at a solution. Struggling a bit is how you learn; struggling for two hours isn’t.
- After reading a solution, close it and write it yourself. Then explain why it works in two sentences.
- Keep a mistakes list. Off-by-one errors, forgotten empty inputs, wrong loop conditions. Read it before each interview.
- Revisit problems after a few days. Spacing practice out is one of the best-supported ways to remember; Wikipedia’s article on spaced repetition explains why.
The routine on the day
Use the same steps for every problem, so you never have to think about what to do next:
- Clarify. Inputs, outputs, sizes, edge cases. Write one or two examples.
- Plan out loud. Describe a simple approach and its complexity.
- Improve if it’s cheap. If you can see a better approach, say it and agree which one to write.
- Code. Clear names, small functions, and talk as you go.
- Test. Walk through an example, then edge cases.
- Discuss. Complexity, trade-offs and what you’d improve with more time.
Thinking out loud is the step most people find hardest. Our guide on how to think out loud in a coding interview shows what to say at each point, and the live coding interview tips cover the rest of the session.
At the planning step: “The simple way is to compare every pair, which is O(n squared). Since we only need to know whether a pair sums to the target, I can keep a set of numbers I’ve seen and check each new number against it in one pass, O(n) time and O(n) space. Shall I write that version?”
The day before and the morning of
The last 24 hours are about being rested and set up, not cramming.
- Check the format. Which editor or platform, whether you can run code, which languages are allowed, how long the session is. The invitation or the recruiter can tell you.
- Test your setup if it’s remote: camera, microphone, a stable connection, a charger. Close notifications and other apps.
- Warm up, lightly. Solve one easy problem out loud in the morning, just to start talking and typing. Don’t attempt anything new and hard.
- Read your mistakes list and your notes on the main patterns.
- Prepare two or three questions for the end of the interview; our list of questions to ask in a technical interview has ideas.
- Sleep. Tired problem solving is measurably worse, and nerves are harder to manage on little sleep.
In the first minute of the call, a short, relaxed introduction sets the tone; see how to introduce yourself in a technical interview.
When things go wrong
- You don’t recognise the problem. Solve a tiny example by hand and look at what you did. Our guide on what to do when stuck in a coding interview has more techniques.
- You find a bug late. Say so and fix it calmly; it counts as testing.
- You run out of time. Explain what’s left and how you’d finish. That still earns credit.
Other rounds to prepare for
Coding is rarely the only round. Expect behavioral questions (see behavioral questions for software engineers) and, for mid-level roles and above, system design. Our list of software engineer interview questions covers what else comes up, and for practice where AI help is allowed, Ghostpilot’s coding interview assistant explains approaches and complexity step by step.
Rehearse the whole routine, free. Ghostpilot’s mock interviews ask technical questions for your role and score how clearly you explain your approach, so the real round feels familiar.
3 mock interviews a month are free, with no card needed.
Start freeQuestions
How many problems should I solve before a coding interview?
There's no magic number. Around 100 to 150 problems chosen to cover the common patterns, solved and reviewed properly, prepares most people better than 400 rushed ones.
Can I pass a coding interview without finishing the problem?
Sometimes. A clear approach, working code for most of it and a good explanation of what's left can still pass, especially in the first round. A silent, unfinished attempt rarely does.
What language should I use in a coding interview?
The one you write most fluently, unless the job requires another. Python is popular because it's short to write, but a language you know well beats one you're learning.
How long does it take to prepare for a coding interview?
Four to eight weeks of regular practice is typical if you already program. If data structures are new to you, allow two to three months.
Get live help in your next interview
Ghostpilot hears each question and shows an answer from your CV, in a small window above your call. Free to start: 2 live interviews and 3 mock interviews a month, no card needed.



