Mock interviews

Sample mock interview

Two example sessions, shown the way a finished interview is: the problem, the conversation, what was submitted, the tests or the whiteboard, and the feedback. This page is stored example data written for it; opening it calls no AI model, and the interviewer's wording in a real session will differ.

Every interview allows 30 questions, 3 hints and 3 graded submissions per problem. See every limit by plan or compare plans.

The problem workspace

What practice looks like on a free problem: pick a language, take a hint, run the code. A failing case shows the input, what was expected and where your output differs; a case that raised an exception is marked as a runtime error instead, with the exception.

Two Sum

EasyOpen it in the editor

Given an array of integers nums and an integer target, return the indices of the two numbers that add up to target. Exactly one such pair exists, and you may not use the same element twice. Return the two indices in increasing order.

Input is [nums, target], e.g. [[2,7,11,15],9].

11 languages in the editor; the starter code changes with the language.
class Solution:
    def twoSum(self, nums, target):
        # Return the two indices (increasing order) that sum to target.
        pass

Hints, one level at a time

Hint 1

A brute-force double loop is O(n²). Can you trade memory for speed?

Hint 2

While scanning, store each value's index in a hash map. For the current value x, check whether target − x has already been seen.

Three runs of the same problem

Recorded, not live: each result is what this code produced through the judge's own test harness with Python 3.11 on 2026-11-20. A live run on the judge uses Python 3.14 and needs an account.

Stores the value before checking for its complement, so a number can pair with itself.

class Solution:
    def twoSum(self, nums, target):
        seen = {}
        for i, x in enumerate(nums):
            seen[x] = i
            if target - x in seen:
                return [seen[target - x], i]
1/3 Passed

Execution summary

Result (1/3)Failed

Total

3

Passed

1

Failed

2

Wrong AnswerYour code ran to the end and returned a different answer.
Input:
[[3,2,4],6]
Expected Output:
[1,2]
Your Output:
[0,0]
Difference:
Expected[1,2]
Got[0,0]

Sample mock interviews

Two sample sessions in the format a finished interview is saved in. They are written for this page, not recordings of a candidate; the scores and the board outline come from the same scoring code a real session uses.

Coding interview

Technical · Mid level · 30 minutes · overall score 84/100

Longest run of distinct characters

Read one line of lowercase letters from standard input and print the length of the longest substring in which no character repeats. Example: abcabcbb → 3 ("abc"). Example: bbbbb → 1. Constraints: 1 ≤ length ≤ 100,000.

  1. Interviewer

    Welcome. Take a minute with the statement, and think out loud as you go.

  2. Candidate

    Can the line be empty, or contain anything other than lowercase letters?

  3. Interviewer

    It has at least one character, and only a to z.

  4. Candidate · Hint used

    Could I have a hint?

  5. Interviewer · Hint used

    Hint: when you see a repeat, how far back must the start of the window move?

  6. Candidate

    Past the previous position of that character, so I keep the last index of each letter. O(n) time, O(1) space for 26 letters.

Submitted code (python)

import sys

s = sys.stdin.readline().strip()
last = {}
start = best = 0
for i, ch in enumerate(s):
    if ch in last and last[ch] >= start:
        start = last[ch] + 1
    last[ch] = i
    best = max(best, i - start + 1)
print(best)

Tests on the judge: 4 of 4 passed (abcabcbb, bbbbb, pwwkew, 100,000 characters).

84/100 · Meets the bar

Strengths

  • Asked about the input before coding.
  • Sliding window with the last index of each character: linear time, constant extra space.
  • Stated the complexity unprompted.

To improve

  • Walk through one example by hand before running the tests.
  • One hint was used to find how far the window start moves.

Follow-up question: How would you change it if the input could be any Unicode text, not just a to z?

System design interview

System design · Senior · 45 minutes · overall score 74/100

Design a URL shortener

Design a service that turns long URLs into short codes and redirects visitors. 100 million new links a month, 10 billion redirects a month. Codes never change once issued. Discuss storage, caching and how codes are generated.

  1. Interviewer

    Welcome. Start wherever you like; I can see your whiteboard as you draw.

  2. Candidate

    Reads dominate, so I put a cache in front of the database. Is a redirect allowed to be slightly stale?

  3. Interviewer

    Codes never change, so a cached redirect is never wrong. What happens on a miss in your "Redis cache"?

  4. Candidate

    The API servers read Postgres by code and fill the cache.

  5. Interviewer

    Your "ID generator" sits beside the "API servers". What happens if it is down?

The whiteboard

Loading the whiteboard…

Notes beside the board

Read heavy, about 100 reads per write. Short codes are base62 of a 64-bit id from the ID generator. Reads go to Redis first (TTL 24 h), then Postgres keyed by code; writes go to Postgres, then fill the cache. Shard Postgres by code.

What the interviewer reads from the board

Components (6):
- "Redis cache"
- "Clients"
- "Load balancer"
- "API servers"
- "Postgres (sharded)"
- "ID generator"

Connections (5; "?" is an end not attached to anything):
- "API servers" -> "Redis cache"
- "Clients" -> "Load balancer"
- "Load balancer" -> "API servers"
- "API servers" -> "Postgres (sharded)"
- "API servers" -> "ID generator"

74/100 · Meets the bar

Strengths

  • Sized the read and write load and put the "Redis cache" on the read path.
  • Codes from a 64-bit "ID generator" avoid collisions without a lookup.
  • Sharding "Postgres (sharded)" by code keeps a redirect to one shard.

To improve

  • The "ID generator" is a single point of failure: say how it is replicated, or hand out id ranges per API server.
  • No analytics path: redirect counts would hit the database on every read.

Follow-up question: How would you count clicks per link without slowing the redirect down?