← Blog

Coding Interview Tips: How to Prepare and How to Think Out Loud

A practical guide to coding interviews: the 45-minute structure, the problem patterns that cover most questions, how to communicate while coding, an 8-week prep plan and common mistakes.

Updated November 19, 2026 6 min read coding interview, technical interview

Key takeaways

  • Interviewers grade your process as much as your final code: clarifying, planning, communicating, testing.
  • Use a fixed 45-minute structure: clarify, brute force, optimize, code, test, analyze complexity.
  • About a dozen problem patterns cover most interview questions. Learn patterns, not individual problems.
  • Think out loud the whole time. Ten silent minutes followed by a perfect solution scores lower than a clear path to a good one.
  • Practice with a timer and out loud, 2–3 problems a day, for 6–8 weeks before big-tech interviews.
Contents

The most important coding interview tip is that the interviewer is grading your process, not just your final answer. Clarify the problem, state a brute-force approach, improve it, then code in small steps while explaining your reasoning, and finish by testing with examples and stating the complexity. Prepare by learning the dozen problem patterns that cover most questions and practicing them out loud with a timer.

What interviewers actually evaluate

A typical coding interview rubric
AreaWhat they look for
Problem solvingBreaks the problem down, considers several approaches, finds an efficient one
CodingCorrect, readable code; good names; sensible structure
CommunicationExplains reasoning before and during coding; responds well to hints
TestingChecks normal and edge cases; finds and fixes own bugs
ComplexityStates time and space complexity correctly and discusses trade-offs

Notice that only one row is about getting the code right. Candidates who solve the problem silently often score lower than candidates who explain a slightly less optimal solution clearly.

The 45-minute structure

Most coding rounds last 45–60 minutes, with the first and last few minutes for introductions and your questions. Use a fixed structure so you never wonder what to do next:

How to spend a 45-minute coding round

Recommended time budget for one medium problem.

Clarify
3–5 min
Restate the problem, ask about input size, edge cases and constraints, write an example
Brute force
2–3 min
Describe the simplest correct approach and its complexity
Optimize
5–8 min
Find the bottleneck and the better approach; agree on it with the interviewer
Code
15–20 min
Write the solution in small pieces, narrating each one
Test
5 min
Trace through your example and edge cases; fix bugs
Complexity
2 min
Time and space, and what you would change for larger input

Step 1: Clarify before coding

Restate the problem in your own words and ask about the input:

  • How large can the input be? (This tells you which complexities are acceptable.)
  • Can it be empty? Contain duplicates? Negative numbers? Is it sorted?
  • What should happen with invalid input?
  • Is there a memory limit?

Write one normal example and one edge case. Two minutes here prevent the most expensive mistake: solving the wrong problem.

Step 2: Start with brute force

“The simplest approach is to compare every pair, which is O(n²). We can probably do better with a hash map.” Naming the naive solution shows you understand the problem and gives you a fallback if the optimal solution doesn’t come.

Step 3: Optimize with patterns

Most interview problems are variations on a small set of patterns. Recognizing the pattern is usually the hardest part.

The patterns behind most coding interview questions
PatternSignals in the problemClassic examples
Hash map / set“find pairs”, “count”, “seen before”, duplicatesTwo Sum, group anagrams
Two pointersSorted array, pairs, palindromes, in-place changesContainer with most water, 3Sum
Sliding windowContiguous subarray or substring with a conditionLongest substring without repeats
Binary searchSorted input, “minimum X such that”, monotonic conditionSearch in rotated array, Koko eating bananas
StackMatching brackets, “next greater element”, undoValid parentheses, daily temperatures
Linked listCycles, middle, reverse, mergeReverse list, detect cycle
Trees (DFS/BFS)Hierarchies, paths, levelsMax depth, level order traversal, LCA
GraphsNetworks, grids, dependenciesNumber of islands, course schedule
Heap / priority queue“Top k”, “k-th largest”, merging sorted listsTop K frequent, merge k sorted lists
IntervalsOverlapping ranges, schedulingMerge intervals, meeting rooms
Backtracking“All combinations / permutations / subsets”Subsets, N-Queens
Dynamic programmingOptimal value over choices, overlapping subproblemsClimbing stairs, coin change, LCS

Use input size to guess the target complexity

If n is up to about 10⁵ or 10⁶, an O(n log n) or O(n) solution is usually expected. If n is around 20, exponential approaches like backtracking may be fine. Asking about input size early tells you which patterns are realistic.

Step 4: Code in small steps, out loud

Outline the steps in comments or out loud first, then write the code piece by piece: “Now I’m building the frequency map… now I scan for the first character with count one.”

  • Use clear variable names (left, right, seen), not a, b, x.
  • Write small helper functions for repeated logic.
  • If you’re unsure about a library function, say so and write a simple version.

Phrases that help

  • “Let me make sure I understand the constraints…”
  • “I’ll start with a straightforward version and optimize after.”
  • “I’m not sure about this edge case; let me test it.”
  • “If memory were tight, I’d trade time for space by…”

Step 5: Test like an engineer

Walk through your code with the example you wrote, tracking variables out loud. Then check edge cases:

Edge cases to check

Always check

  • Empty input and a single element
  • Duplicates and all-equal values
  • Negative numbers and zero
  • Very large values (overflow in some languages)
  • Already sorted and reverse-sorted input

Common bugs

  • Off-by-one errors in loops and slices
  • Forgetting to update a pointer, so the loop never ends
  • Mutating input that the caller still needs
  • Returning inside a loop too early
  • Not handling a missing key in a map

Finding and fixing your own bug is a positive signal, not a failure.

Step 6: State the complexity

Give time and space complexity and explain where they come from: “We visit each element once and the map holds at most n entries, so O(n) time and O(n) space.” Then mention a trade-off: what you would change for much larger input or tight memory.

An 8-week preparation plan

Eight weeks to interview-ready

About 1–2 hours a day. Compress for smaller companies, extend if you are rusty.

  1. Weeks 1–2: foundationsArrays, strings, hash maps, two pointers, sliding window. Easy and medium problems.
  2. Weeks 3–4: core structuresStacks, linked lists, binary search, trees with DFS and BFS.
  3. Week 5: graphs and heapsGrids, BFS and DFS on graphs, topological sort, top-k problems.
  4. Week 6: harder patternsIntervals, backtracking, an introduction to dynamic programming.
  5. Week 7: mixed practiceRandom medium problems under a 25-minute timer, out loud.
  6. Week 8: mock interviewsFull 45-minute sessions with a friend or recording; review weak patterns.
How to split practice by pattern

A suggested distribution of your practice problems, weighted toward the most common patterns.

Arrays, strings and hash maps 20%
Trees and graphs 20%
Two pointers and sliding window 15%
Dynamic programming 12%
Binary search 10%
Stacks, heaps and intervals 13%
Linked lists and backtracking 10%

Common mistakes

What separates strong and weak candidates

Strong

  • Asks about constraints before coding
  • Explains the approach and gets agreement first
  • Narrates while coding
  • Tests with examples without being asked
  • Stays calm and uses hints well

Weak

  • Starts typing immediately
  • Long silences
  • Ignores the interviewer’s hints
  • Declares “done” without testing
  • Gives up when the optimal solution doesn’t come

Online assessments vs live interviews

Many companies start with an automated online assessment on platforms like HackerRank or CodeSignal. These are timed and scored on test cases, so correctness and speed matter more than communication. Read the rules on the first screen, note which tools are allowed, and practice under the same time limits. The live rounds that follow are where communication becomes decisive.

Beyond algorithms

For mid-level and senior roles, expect a system design interview as well, and behavioral rounds that use the STAR method. Our overview of the tech interview process explains how the rounds fit together, and the interview questions by role section covers language-specific questions such as Python and JavaScript.

Sottena has an “out loud” answer profile that turns a solution into a talk-through outline: restating the problem, the approach, code in chunks with commentary and a dry run. It’s a practical way to rehearse exactly the communication skills described above. Use it in line with the rules of each interview.

Frequently asked questions

How many LeetCode problems should I solve before a coding interview? +
There is no magic number. Many candidates solve around 100 to 200 problems, but coverage of patterns matters more than count. Make sure you can solve medium problems from each major pattern within about 25 minutes while explaining your approach.
What programming language should I use in a coding interview? +
The one you are most fluent in, unless the role requires a specific language. Python is popular because it is concise, but speed and correctness in a language you know well matter more.
What if I can't solve the problem? +
Keep communicating. Explain the brute-force solution, implement it if you can, and discuss where the bottleneck is. Partial progress with clear reasoning often passes, especially when you respond well to hints.
Is it okay to ask the interviewer for a hint? +
Yes. Asking a specific question (“Would a sorted input change the approach?”) is better than staying stuck in silence. How you use hints is part of the evaluation.
Should I write tests in a coding interview? +
Walk through your code with one normal example and a few edge cases, tracking variables out loud. Formal unit tests are rarely expected unless the interviewer asks for them.

Get a talk-through outline for coding questions in real time

Sottena listens to the interviewer, detects each question and shows short answer points in about a second. 150 free credits, no card required.

Keep reading