Interview round · in depth

Coding interview practice: explain the approach, then run the tests

Practice coding interviews the way the round is run: clarify the problem, state a baseline, improve it, then prove it with tests. Lab drills run in a JavaScript or Python sandbox in your browser.

Free during early access. Practice runs in the app, which needs an account.

Prep sheetCoding

  1. 01Clarifying inputs and edge cases
  2. 02Hash maps, stacks and two pointers
  3. 03Sliding windows and heaps
  4. 04Complexity and testing

Next repTechnical interview lab

01Common prompts

Sample coding interview questions

These coding interview questions are practice prompts written or adapted by InterviewWare, not questions reported by any employer. Each comes with the signals an interviewer listens for and the follow-up that usually comes next.

QuestionWhat the interviewer listens forLikely follow-up
R2 · Role depth & case
Q01 How would you find the first non-repeating character in a string?Two passes with a count map for O(n) time, and a question about the character set before choosing a fixed-size array or a map.What changes if the characters arrive as a stream and you must answer after each one?
Q02 Explain how you would detect a cycle in a linked list, and where it starts.A visited set first, then fast and slow pointers for O(1) space, with an honest explanation of why they meet.Why does moving one pointer back to the head find the entry of the cycle?
Q03 Check whether a binary tree is a valid binary search tree.Lower and upper bounds passed down the recursion rather than comparing a node only with its children, and an explicit rule for duplicates.How would you do it iteratively, and what does it cost in space on a skewed tree?
Q04 Count the islands in a grid of land and water cells.BFS or DFS from each unvisited land cell, marking what has been visited, and a note on recursion depth for large grids.If the grid changes one cell at a time, how would you keep the count without rescanning?
Q05 Return the k-th largest number in an unsorted array.Sorting as the baseline, a size-k min-heap for O(n log k), and quickselect’s average O(n) with its worst case stated.Which approach would you choose if the array does not fit in memory?
Q06 Given a list of daily prices, find the best profit from one buy followed by one sell.One pass that tracks the lowest price so far; brute force mentioned but not written; an empty list and falling prices tested aloud.What changes if you may buy and sell as many times as you like?

02Try one question

Coding interview practice: talk through one problem

Draft an answer to one of the questions above. It stays in this browser until you ask for feedback.

Practice question · Coding

How would you find the first non-repeating character in a string?

0 words

Feedback needs a free account (one step, no card). Your draft is kept only in this browser and filled in after you sign up; nothing is sent until you submit it.

03Technical lab

Coding drills you can run in the lab

Each drill runs in JavaScript or Python against public tests in your browser. The table shows the pattern and the complexity an interviewer would usually expect.

Technical lab drills
DrillPatternDifficultyTarget timeTarget space
01Pair sumHash mapEasyO(n)O(n)
02Balanced bracketsStackEasyO(n)O(n)
03Search insert positionBinary searchEasyO(log n)O(1)
04Merge sorted arraysTwo pointersEasyO(m + n)O(m + n)
05Merge intervalsSorting · IntervalsMediumO(n log n)O(n)
06Group anagramsHash map · StringsMediumO(n · k log k)O(n · k)
07Longest unique runSliding window · Hash mapMediumO(n)O(k)
08Top K frequentHash map · Heap / bucketsMediumO(n log k)O(n)
09LRU cache simulatorDesign · Hash map + listMediumO(1) per operationO(capacity)
10Sliding window maximumMonotonic deque · Sliding windowHardO(n)O(k)

Open the technical labRequires an account.

04Worked example

Return the k most frequent numbers in an array.

What to say before and after you code; mid-level, about two minutes of talking. Illustrative sample written by InterviewWare, not a real candidate’s answer.

  1. 01

    Clarify

    Can k exceed the number of distinct values, and does the order of the result matter? I’ll assume k is valid and any order is fine.

  2. 02

    Baseline

    Count with a hash map, then sort the distinct values by count: O(n log n) in the worst case.

  3. 03

    Improve

    Keep a min-heap of size k while scanning the counts, which gives O(n log k); bucketing by count would give O(n).

  4. 04

    Test

    Before calling it done, I’ll run a case with tied counts and a case where k equals the number of distinct values.

05Coaching notes

How to answer coding interview questions

What works

  1. T1Restate the problem and ask about input size, duplicates, empty input and the return type before you touch code.
  2. T2Say the brute-force idea and its complexity in one sentence, then improve it; interviewers want to see that step.
  3. T3Narrate while you write, and name the invariant your loop keeps.
  4. T4Before you say you’re done, walk one normal case and one edge case through the code by hand.

Common mistakes in coding interviews

  1. M1Coding in silence for ten minutes, so the interviewer can neither help nor credit your reasoning.
  2. M2Jumping to a memorised optimal solution you can’t explain.
  3. M3Quoting O(n) without saying what n is, or forgetting the space a hash map uses.
  4. M4Testing only the example given in the prompt.
  5. M5Naming variables a, b and tmp under pressure, then losing track of your own code.

06Tools that help

Tools for coding interview prep

  1. Technical interview lab

    Run the drills below against public tests in JavaScript or Python, with nothing to install, and save a draft to discuss.

    JS · PythonPublic tests
  2. Conversational AI mock interviews

    Talk a saved solution through with the engineering-lead interviewer, who presses on complexity and the alternatives you rejected.

    4 interviewersR1–R3Text · voice
  3. Interview speaking practice

    Record a two-minute explanation of your approach and see whether pace or fillers get in the way.

    PaceFillers · pauses

More directions

Explore another direction

Early access · free

Log your first rep today.

Bring a resume or a job description — or just the role you want. The log starts with your first answer.