Software Engineering interview questions

Software engineering loops usually mix live coding, system design and a behavioral round. Interviewers want working code you can explain, a design whose trade-offs you can defend, and stories that show ownership.

24 questions below, each one a practice interview: the AI interviewer asks it out loud, follows up on your answer, and sends you a scored feedback report.

Practise free with the AI interviewer

Behavioral questions

Leading a Production Incident

Behavioral · Medium · 20 min · Free to practise

A behavioral interview about leading the response to a production incident and what happened afterwards, for software engineers who have been on call.

Be ready to discuss:

  • An incident where you led or coordinated the response; it does not need to be one you caused. What was the impact, and how did you find out?
  • How you decided between restoring service quickly (a rollback, a feature flag, failing over) and finding the root cause, and how you organized the people involved.
  • How you kept stakeholders, support and customers informed while it was happening.
  • The postmortem: how you kept it blameless, what the real causes were, which follow-up actions you chose, and whether they were actually completed.

Use the STAR structure (situation, task, action, result) and be specific about your own role, the timeline and the numbers, such as minutes of downtime or users affected.

Practise this question with the AI interviewer

Tech Debt Versus Feature Pressure

Behavioral · Medium · 20 min

A behavioral interview about balancing technical debt and reliability work against pressure to ship features, for software engineers.

Be ready to discuss:

  • A time you pushed back on a deadline or a feature request because of technical debt or a reliability risk. What evidence did you bring, and how did you put the cost in terms the business cared about?
  • Who you had to convince, what they cared about, and the compromise you reached.
  • A time you deliberately chose to take on debt to ship faster: how you limited the damage and made sure it was paid down.
  • A time you were wrong: debt you warned about that never mattered, or debt you dismissed that later hurt.

Use the STAR structure (situation, task, action, result) and be specific about the trade-off, the people involved and what happened afterwards.

Practise this question with the AI interviewer

Coding questions

See all coding questions

Two Sum

Coding · Easy · 20 min · Free to practise

Given an array of integers nums and an integer target, return the indices of the two numbers that add up to target.

You may assume exactly one valid answer exists, and you may not use the same element twice.

Example

Input: nums = [2, 7, 11, 15], target = 9
Output: [0, 1]

Discuss your approach out loud before coding. What is the brute-force complexity? Can you do better?

Practise this question with the AI interviewer

Design an LRU Cache

Coding · Medium · 30 min · Free to practise

Design a data structure for a Least Recently Used (LRU) cache.

Implement get(key) and put(key, value), both in O(1) average time. When the cache exceeds capacity, evict the least recently used entry.

Walk through your data-structure choices and their trade-offs before writing code.

Practise this question with the AI interviewer

Deploy Services in Dependency Waves

Coding · Medium · 30 min · Free to practise

The platform team at Larkfield Freight deploys its microservices in waves. A service may deploy only after every service it depends on has deployed in an earlier wave; all services in one wave deploy in parallel.

Write planWaves(services, dependencies):

  • services: a list of unique service names.
  • dependencies: a list of pairs [a, b] meaning a depends on b, so b must deploy first.

Return two lists: waves, the services that can deploy, grouped into as few waves as possible, each wave sorted alphabetically; and blocked, sorted, every service that can never deploy because of a dependency cycle.

Example 1

services     = ["api", "auth", "billing", "db", "web"]
dependencies = [["api","db"], ["auth","db"], ["billing","api"], ["web","api"], ["web","auth"]]
Output: waves = [["db"], ["api","auth"], ["billing","web"]], blocked = []

Example 2

services     = ["cache", "queue", "search", "worker"]
dependencies = [["queue","worker"], ["worker","queue"], ["search","queue"]]
Output: waves = [["cache"]], blocked = ["queue", "search", "worker"]

Constraints

  • Up to 100,000 services and 200,000 dependency pairs; every name in a pair is in services.
  • The same pair may appear twice, and a service may list itself.

What to discuss

Why your grouping gives the fewest waves, how you find the blocked services, and the time and space complexity. If time allows: one deploy in a wave fails. Which services in later waves must now be held back?

Practise this question with the AI interviewer

Flag Overlapping Maintenance Windows

Coding · Medium · 30 min

Cirrine Cloud schedules maintenance windows for each of its regions. Reliability rules say no more than a few regions may be in maintenance at the same time, and the scheduling team wants a tool that flags every conflict.

Write crowdedSpans(windows, k):

  • windows: a list of [region, start, end], a region name and a half-open interval [start, end) in minutes.
  • k: the threshold.

Return, sorted by start, the time spans [start, end) during which at least k distinct regions are in maintenance at once. Merge spans that overlap or touch into one. A region's own windows may overlap; a region counts once however many of its windows cover a moment.

Example 1

windows = [["east",0,60], ["east",30,90], ["west",50,120], ["north",100,150], ["north",140,160]]
k = 2
Output: [[50,90], [100,120]]

Example 2

windows = [["a",0,10], ["b",0,5], ["c",5,10]]
k = 2
Output: [[0,10]]

Constraints

  • Up to 200,000 windows; 0 <= start < end <= 10^9, integers.
  • 1 <= k <= the number of distinct regions.

What to discuss

How you order events that share a timestamp, why a region's overlapping windows need care, and your time and space complexity. Trace Example 2 out loud before you run anything.

Practise this question with the AI interviewer

Simulate a Build Farm Scheduler

Coding · Medium · 35 min · Free to practise

Quillstone's CI system runs builds on m identical machines. Each job has an id, a submit time, a duration and a priority, where a lower number is more urgent.

Whenever a machine is free and jobs are waiting, it starts the waiting job with the lowest priority number; ties go to the earlier submit time, then the smaller id. A running job is never interrupted. A machine that frees up at time t can start a job submitted at time t.

Write finishTimes(m, jobs), where each job is [id, submit, duration, priority], and return each job's finish time in the order the jobs were given.

Example

m = 2
jobs = [[1,0,5,2], [2,0,3,1], [3,1,4,1], [4,2,2,3], [5,3,1,0]]
Output: [5, 3, 8, 7, 4]

At time 3 job 2 finishes and job 5 arrives with priority 0, so it starts ahead of job 3, which has waited since time 1.

Constraints

  • Up to 200,000 jobs, not sorted by submit time; 1 <= m <= 10,000.
  • Times and durations are integers up to 10^9; durations are at least 1.

What to discuss

Which data structures you need and why, how you skip idle stretches when no job is waiting, and the complexity. If time allows: low-priority jobs can starve. How would you let a job's priority improve the longer it waits, and what does that do to your data structures?

Practise this question with the AI interviewer

Pack Records into Padded Blocks

Coding · Medium · 35 min

Bramblecode's storage engine writes records to disk in arrival order, grouped into blocks. A block holds between 1 and k consecutive records. Every record in a block is padded to the width of the widest record in that block, and every block also costs a header of h bytes. A block holding c records whose widest is w bytes therefore costs h + c * w bytes.

Write minBytes(widths, k, h) that returns the smallest total number of bytes needed to store all records. The order of records cannot change.

Example 1

widths = [4, 1, 1, 6, 6, 2], k = 3, h = 5
Output: 39

Blocks [4], [1, 1], [6, 6, 2] cost 9 + 7 + 23. Filling every block to k records costs 40.

Example 2

widths = [2, 9, 2], k = 3
h = 1  -> Output: 16 (three blocks of one)
h = 10 -> Output: 37 (one block of three)

Constraints

  • Up to 100,000 records; 1 <= k <= 200; widths and h are integers from 1 to 10^6.

What to discuss

Why a greedy rule fails, the recurrence you use, its time and memory, and the size of the answer at the limits. If time allows: also return where each block starts.

Practise this question with the AI interviewer

Find a Fair Per-Tenant Throughput Cap

Coding · Medium · 30 min · Free to practise

Fernhollow Systems runs a shared message queue that can process at most capacity messages per second across all tenants. When total demand exceeds capacity, every tenant is held to the same cap c: a tenant asking for d messages per second gets min(d, c). Small tenants are untouched, and the biggest ones absorb the shortfall.

Write fairCap(demands, capacity) that returns the largest integer c such that the tenants' total allowance, the sum of min(d, c), does not exceed capacity. If total demand already fits, return -1: no cap is needed.

Example 1

demands = [120, 40, 300, 75], capacity = 400
Output: 165

With c = 165 the allowances are 120, 40, 165 and 75, which sum to 400. With 166 they sum to 401.

Example 2

demands = [5, 5, 5], capacity = 2
Output: 0

Constraints

  • Up to 100,000 tenants; each demand is an integer from 1 to 10^9; capacity is up to 10^14.

What to discuss

What property of the problem lets you search for c instead of trying every value, your complexity, and the overflow risks. If time allows: demands change every second, one tenant at a time. How would you keep the cap current without recomputing from scratch?

Practise this question with the AI interviewer

Build an HTTP Route Matcher

Coding · Hard · 45 min · Free to practise

Your team is building the request router for an in-house web framework. Implement a router with two operations:

  • addRoute(pattern, handler): register a pattern such as /users/:id/files/*path. A segment is a literal (users), a parameter (:id, which matches exactly one segment) or a catch-all (*path, allowed only as the last segment, which matches one or more remaining segments). Registering a pattern with the same shape as an existing one (/users/:id and /users/:uid) is an error.
  • match(path): return the handler and the captured values, or nothing when no route matches.

When several routes match, compare them segment by segment from the left: at the first segment where they differ, a literal beats a parameter, which beats a catch-all.

Example

addRoute("/users/me", "currentUser")
addRoute("/users/:id", "userById")
addRoute("/users/:id/files/*path", "userFile")
addRoute("/users/me/settings", "mySettings")

match("/users/me")                  -> currentUser, {}
match("/users/42")                  -> userById, {id: "42"}
match("/users/me/files/docs/cv.pdf") -> userFile, {id: "me", path: "docs/cv.pdf"}
match("/users/42/files")            -> no match

Constraints

  • Up to 10,000 routes and 100,000 match calls; paths start with /, have at most 20 segments and no empty segments.

What to discuss

Your data structure, how matching recovers when a more specific branch dead-ends, and the worst-case cost of a match. Part two: the router must serve a million matches per second while routes are reloaded every few minutes. Can you bound the worst case, and how do readers stay safe during a reload?

Practise this question with the AI interviewer

Count Network Groups After Fiber Cuts

Coding · Hard · 45 min

Veltrane runs a data center with n racks, numbered 0 to n - 1, joined by fiber links. After an outage, the incident report lists the links that were cut, in the order they were cut. The reliability team wants to know how fragmented the network was after each cut.

Write groupsAfterCuts(n, links, cuts):

  • links: a list of pairs [u, v], each a link between two racks.
  • cuts: indexes into links, in the order the links were cut. Each link is cut at most once.

Return a list with one entry per cut: the number of connected groups of racks right after that cut.

Example

n = 5
links = [[0,1], [1,2], [2,0], [3,4], [2,3]]
cuts  = [4, 0, 1]
Output: [2, 2, 3]

Cutting link 4 splits {0,1,2} from {3,4}. Cutting link 0 changes nothing, since 0 and 1 still meet through 2. Cutting link 1 isolates rack 1.

Constraints

  • n up to 100,000; up to 200,000 links, which may include parallel links between the same racks.

What to discuss

Why removing links is harder than adding them, how you avoid recomputing the groups after every cut, and your complexity. Part two: cuts now arrive live and you must answer each one before you see the next. What changes, and what can you still do better than a full recount?

Practise this question with the AI interviewer

Design a Live Contest Leaderboard

Coding · Hard · 45 min

Puzzlevine runs weekly programming contests and needs a live leaderboard. Implement a class with these operations:

  • submit(player, points): add points (an integer from 1 to 100) to the player's score; a new player starts at 0.
  • rank(player): 1 plus the number of players with a strictly higher score, so tied players share a rank; -1 for an unknown player.
  • top(k): the k best players as (player, score) pairs, highest score first, ties broken by player name.
  • remove(player): delete the player from the leaderboard.

Example

submit("ana", 50); submit("bo", 80); submit("cy", 50); submit("dee", 20)
rank("bo") -> 1   rank("ana") -> 2   rank("cy") -> 2   rank("dee") -> 4
top(3)     -> [("bo",80), ("ana",50), ("cy",50)]
submit("dee", 40)
rank("dee") -> 2  rank("ana") -> 3
remove("bo")
rank("dee") -> 1  rank("bo") -> -1

Constraints

  • Up to 100,000 players and 1,000,000 operations; a player submits at most 10,000 times; k <= 100.
  • rank and top must be much faster than scanning every player.

What to discuss

The structures you choose and the cost of each operation, and how your choice depends on the score range. Part two: the contest grows to ten million players across many servers. Exact ranks are needed only for the top 1,000; everyone else may see an approximate rank. How would you design that?

Practise this question with the AI interviewer

Evaluate Access Policy Expressions

Coding · Hard · 45 min · Free to practise

Merrowgate's internal tools decide who may open an admin page by evaluating policy expressions against the signed-in user's attributes. Write evaluate(expression, attributes) that returns true or false, or signals an error.

The language:

  • A comparison name op value, where op is one of == != < <= > >= and value is a double-quoted string (no escapes) or a non-negative integer.
  • A bare attribute name, used as a boolean, and the literals true and false.
  • not, and, or (binding in that order, tightest first) and parentheses.
  • attributes maps names to strings, integers or booleans. A missing attribute makes its comparison, or its bare use, false.
  • A syntax error, comparing different types, or ordering (<, >...) strings or booleans is an error whose message says where it happened.

Examples

role == "admin" or team == "billing" and level >= 3
  with {role: "admin", team: "support", level: 1}       -> true

not (suspended or level < 2)
  with {level: 5, suspended: false}                    -> true

level >= "3"
  with {level: 4}                                      -> error: type mismatch

Constraints

  • Expressions are up to 2,000 characters and may nest parentheses up to 50 deep.

What to discuss

How you split tokenizing, parsing and evaluating, how precedence falls out of your design, and your tests. Part two: 500 policies are evaluated millions of times a minute against different users. What would you do once, and what per request? Does short-circuiting hide errors on the right-hand side, and is that acceptable?

Practise this question with the AI interviewer

System Design questions

See all system design questions

Design a URL Shortener

System Design · Medium · 35 min · Free to practise

Design a URL-shortening service like bit.ly.

Cover: API design, short-code generation, storage schema and estimates, read/write ratio, caching, redirects, and how the design scales to 100M new URLs per month.

Start with requirements clarification, then work through the design end to end.

Practise this question with the AI interviewer

Design a Rate Limiter Service

System Design · Medium · 35 min · Free to practise

Design the rate-limiting service behind Pallwick, a developer platform whose public APIs are served by about 40 gateway nodes in three regions.

Product teams configure limits without a deploy: per API key (for example 100 requests per second with short bursts allowed, and 10,000 per hour), per key and endpoint, and per IP address for unauthenticated calls. A rejected request gets HTTP 429 with a hint of when to retry.

Rough scale to start from: 2 million requests per second at peak, 5 million active API keys, and the limit check may add at most 5 ms at p99 to a request.

Cover:

  • The limiting algorithm (fixed window, sliding window, token bucket) and what each costs in memory and accuracy.
  • Where counters live, and how gateway nodes and regions share them without a network round trip on every request.
  • What happens when the counter store is slow or down: fail open or fail closed, and for which limits.
  • Hot keys, and how limit changes reach the gateways.

Start by clarifying requirements, then work through the design end to end.

Practise this question with the AI interviewer

Design Live Score Alert Fanout

System Design · Medium · 40 min

Design the push-alert system for Scorvia, a sports app. Users follow teams, players and matches, and choose which alerts they want: goals, kickoff, final score. When a goal is scored, every interested follower should get a push notification on each of their devices.

Rough scale to start from: 60 million installed devices and 25 million daily users; the most-followed team has 18 million followers; a busy evening has 300 matches at once. A goal alert should reach 95% of recipients within 5 seconds of the event arriving from the data feed.

Cover:

  • Ingesting events from the data provider, including duplicates and corrections.
  • The fanout model: precomputed recipient lists or a lookup at send time, and how per-user preferences, muted matches and quiet hours are applied.
  • Sending through the mobile platforms' push services, which limit throughput per connection and reject expired device tokens.
  • Retries, delivery tracking and what you would monitor during a big final.

Start by clarifying requirements, then work through the design end to end.

Practise this question with the AI interviewer

Design a Video Upload and Transcoding Pipeline

System Design · Medium · 40 min · Free to practise

Design the video upload and processing pipeline for Lumenhall, an online course platform. Instructors upload lecture videos, often over unreliable connections. Each video is transcoded into several renditions (1080p, 720p, 480p and audio-only), packaged for adaptive streaming, given thumbnails and auto-generated captions, and published to students when ready. Instructors see progress while they wait.

Rough scale to start from: 50,000 uploads per day with a peak of three times the average on Sunday evenings; files up to 4 GB and 3 hours long; transcoding one hour of video into one rendition takes about 30 minutes on a single worker; students watch about 20 million hours per month.

Cover:

  • Resumable uploads and where raw and processed files are stored.
  • Orchestrating the processing steps, including splitting long videos into chunks to process in parallel.
  • Retries, duplicate work and partial failure: what if one rendition fails?
  • Status updates for instructors, delivery to students, and keeping compute cost down.

Start by clarifying requirements, then work through the design end to end.

Practise this question with the AI interviewer

Design Search Autocomplete

System Design · Medium · 35 min

Design search autocomplete for Tessaly, an online marketplace. As a shopper types in the search box, up to 8 suggested queries appear, ranked by how often shoppers searched for them, with recent days weighted more. A query that starts trending should appear in suggestions within 15 minutes. Suggestions must exclude offensive terms and queries that return no products, and are tailored to the shopper's language; the site supports 12.

Rough scale to start from: 40 million daily users; about 6 suggestion requests per search as people type; 150,000 suggestion requests per second at peak; 100 million distinct queries logged per month. A suggestion must reach the shopper within 50 ms at p99.

Cover:

  • The data structure that serves a prefix lookup quickly, and what you precompute.
  • The pipeline from raw search logs to suggestions, and how trending queries take the fast path.
  • Serving and caching at each layer, partitioning the data, and very hot prefixes such as single letters.
  • Filtering, and how you would measure whether suggestions are good.

Start by clarifying requirements, then work through the design end to end.

Practise this question with the AI interviewer

Design a Real-Time Chat System

System Design · Hard · 40 min

Design a real-time chat system (1:1 and group) supporting online presence, delivery receipts, and message history.

Cover: connection management (WebSockets), message fan-out, ordering guarantees, storage, offline delivery/push, and scaling to 50M daily actives.

Practise this question with the AI interviewer

Design Real-Time Collaborative Editing

System Design · Hard · 45 min

Design real-time collaborative editing for Folioweave, a document product. Several people edit the same rich-text document at once, see each other's cursors, and see each other's edits almost immediately. A person can keep editing offline for hours, and when they reconnect both their work and everyone else's must survive. Every document has a browsable version history.

Rough scale to start from: 10 million documents edited per day; 99% of active documents have 1 to 3 editors at a time, but a company-wide document can have 200 editors and 2,000 viewers at once; documents reach 5 MB. Edits should appear for others in the same document within 200 ms.

Cover:

  • How concurrent edits are merged: operational transformation or a CRDT, and what the server's role is in each.
  • Routing every editor of one document to the same place, and what happens when that server dies.
  • Storage: an operation log, snapshots, and how a document loads quickly.
  • Cursors and presence, offline merge, and version history.

Start by clarifying requirements, then work through the design end to end.

Practise this question with the AI interviewer

Design an Idempotent Payment Ledger

System Design · Hard · 45 min · Free to practise

Design the ledger and payments service for Tallowmere Market, an online marketplace with built-in wallets. Buyers pay sellers, the marketplace takes a fee on every sale, buyers can be refunded, and sellers withdraw their balance to a bank account. Card charges and bank payouts go through an external payment processor.

Requirements: every movement of money is recorded as double-entry and never edited; a payment happens exactly once even when the mobile app retries after a timeout; a seller's wallet can never go negative; and the ledger is reconciled daily against the processor's settlement file.

Rough scale to start from: 3,000 payments per second at peak, 20 million wallets, about 400 million ledger entries per month, and balance reads under 50 ms at p99. For writes, correctness matters more than availability.

Cover:

  • The data model for accounts, transactions and entries, and how balances are read.
  • Idempotency keys: where they are stored, their scope, and what a retry returns.
  • Calls to the external processor that can fail or time out, and keeping the ledger and the processor consistent.
  • Hot accounts, reconciliation and auditing.

Start by clarifying requirements, then work through the design end to end.

Practise this question with the AI interviewer

Design a Metrics Ingestion and Query System

System Design · Hard · 45 min

Design the metrics system behind a large software company's internal observability platform. Services emit counters, gauges and histograms tagged with labels such as service, host, endpoint and status code. Engineers build dashboards on them, and alert rules run against them continuously.

Rough scale to start from: 200,000 hosts, each emitting about 2,000 series every 10 seconds; raw data kept for 15 days and 5-minute rollups for 13 months; 20,000 alert rules evaluated every 30 seconds; dashboard queries over the last 24 hours should return within 2 seconds at p95.

Cover:

  • The ingestion path: push or pull, buffering, and what happens when storage falls behind.
  • What identifies a series, how labels are indexed, and how samples are stored and compressed.
  • Downsampling and retention.
  • Query execution across many storage nodes, and keeping alerting healthy when dashboards overload the query path.
  • Protecting the system from label combinations that explode the number of series.

Start by estimating the load, then work through the design end to end.

Practise this question with the AI interviewer

Technical Knowledge questions

Concurrency: Races, Locks and Deadlocks

Knowledge · Medium · 20 min · Free to practise

A knowledge interview on concurrency, at the level of an early-career backend engineer who writes multi-threaded or asynchronous services.

Be ready to explain, in your own words, and apply to examples:

  • Race conditions: check-then-act and read-modify-write, and what a critical section is.
  • The tools: mutexes, read-write locks, atomic operations and compare-and-swap, and when each fits.
  • Deadlock: the conditions that cause it and practical ways to prevent it, such as lock ordering and timeouts.
  • Lock-free versus lock-based designs, and why lock-free is not automatically faster.
  • Why single-threaded asynchronous code (an event loop with await) can still have races.

The interviewer will describe short pieces of code in words, such as a shared counter, a lazily loaded cache or a money transfer between two accounts, and ask what can go wrong and how you would fix it. Use whichever language you know best for examples.

Practise this question with the AI interviewer

Transactions and Isolation Levels in Practice

Knowledge · Hard · 25 min

A knowledge interview on database transactions and isolation, at the level of a backend engineer with a few years of experience who owns services on a relational database.

Be ready to explain, in your own words, and apply to examples:

  • What each ACID property guarantees, and which one isolation levels are about.
  • The concurrency anomalies: dirty reads, non-repeatable reads, phantoms, lost updates and write skew.
  • The standard isolation levels, what each prevents, and how multi-version concurrency control and snapshot isolation work underneath.
  • How to protect a read-then-write: atomic updates, constraints, row locks, optimistic version checks, or serializable isolation with retries.
  • The costs of a stricter level: blocking, aborts and the retry logic your code then needs.

The interviewer will describe a few concurrent requests against tables you will recognize, such as bookings and balances, and ask what can go wrong at a given isolation level and how you would fix it. No particular database is assumed; say which engine you are thinking of when behavior differs.

Practise this question with the AI interviewer