Bolt interview questions & answers

16 real Bolt interview questions with full model answers — System design, Behavioral, Coding, Technical. Drawn from the same verified bank ChannelPulse drills from (16 Bolt questions in total).

BehavioralMediumBoltSoftware EngineerTeam fit interview

1. Have you collaborated with other teams to build or achieve something?

The full question

Have you collaborated with other teams to build or achieve something? What was your best collaboration, what made it great, and what was your most challenging collaboration?

Model answer

  1. Situation — One of my best collaborations was delivering a checkout improvement that depended on the mobile, backend, design, and payments teams. No team could complete it alone: the user experience depended on consistent payment states and reliable handling of delayed responses. A more challenging collaboration was a separate cross-team integration where ownership and API expectations were unclear, and both teams had release commitments.
  2. Task — In the first effort, I needed to help the group deliver a coherent, safe experience. In the second, I needed to get us aligned on an interface and sequence of work without allowing schedule pressure to create avoidable production risk.
  3. Action
  • For the checkout work, I helped establish a shared definition of success and wrote down the key states and failure cases, including a payment that was still processing when the client timed out.
  • I worked with the other engineers to agree on the API contract and backward-compatible behavior before parallel implementation. We used short design reviews and a shared test plan to expose mismatches early.
  • I kept decisions and owners visible, raised dependencies as soon as they became risks, and made sure design and operations could review the fallback experience.
  • For the harder integration, I first spoke with the partner team to understand their deadline and constraints rather than assuming they were being unresponsive. I then proposed a minimal versioned contract, a mock endpoint, and a staged rollout so each team could make progress independently.
  • When we disagreed about whether to include an optional field in the first release, I brought the discussion back to user impact and rollback cost. We deferred it behind a feature flag and documented how we would revisit it.
  1. Result — The checkout change shipped on schedule, and the pilot improved completion by 8% without increasing payment-related support contacts. The integration also launched without blocking either team’s other work. I learned that great collaboration comes from shared outcomes and early clarity; in difficult partnerships, listening and making trade-offs explicit are more effective than escalating too soon.
BehavioralMediumBoltSoftware EngineerTeam fit interview

2. What is your involvement in the idea generation and ideation process for your future work?

Model answer

  1. Situation — In my current team, we periodically review friction in a customer-facing flow. I treat ideation as a continuing part of engineering, not something that happens only in a kickoff meeting: engineers often see reliability, usability, and operational issues directly in the code and support signals.
  2. Task — My role is to bring useful opportunities to the team, help evaluate them against user and business needs, and turn the best ideas into testable work without prematurely committing to a solution.
  3. Action
  • I start with evidence: customer feedback, funnel data, incident trends, and conversations with product, design, and operations. I try to distinguish a repeated user problem from a solution someone has already decided to build.
  • I make ideas concrete by describing the user, the pain point, the expected outcome, and the assumptions. For example, when we saw users abandoning a checkout step, I proposed testing clearer status and error guidance before suggesting a larger redesign.
  • I invite perspectives early, especially from teammates closest to the affected users or systems. I ask what constraints I may be missing and make space for people to challenge the initial framing.
  • I compare options using expected impact, effort, risk, and reversibility. I prefer a small experiment when the evidence is weak, and I identify success and guardrail metrics before implementation.
  • Once we agree on a direction, I help define a thin technical slice, call out dependencies, and revisit the idea after launch rather than treating delivery as proof that it worked.
  1. Result — In that example, we aligned on a small change and measured its effect rather than committing to a broad rewrite; the pilot reduced abandonment at that step by 8% without increasing support contacts. I learned that my strongest contribution to ideation is connecting engineering details to a clearly evidenced user problem, then helping the team learn quickly.
CodingEasyBoltSoftware Engineer

3. Minimum String Length After Removing Substrings (LeetCode)

Model answer

The task

Repeatedly remove any occurrence of "AB" or "CD" from a string until neither remains. Return the length of the resulting string.

Key idea

A stack keeps the characters that have not been removed. When a new character completes one of the two removable pairs with the stack’s top, pop the top instead of adding the new character.

Approach

  1. Start with an empty stack.
  2. Scan the string from left to right.
  3. For each character, check whether it forms "AB" or "CD" with the stack’s top.
  4. If it does, pop the top; otherwise, push the character.
  5. Return the stack’s length.
class Solution:
    def minLength(self, s: str) -> int:
        stack = []

        for char in s:
            # Remove the pair if this character completes one.
            if stack and (
                (stack[-1] == "A" and char == "B")
                or (stack[-1] == "C" and char == "D")
            ):
                stack.pop()
            else:
                stack.append(char)

        return len(stack)

Complexity:

  • Time: O(n), where n is the string length; each character is processed once.
  • Space: O(n) in the worst case, for the stack.

Common follow-ups

  • What if there are more removable pairs? Store the allowed pairs in a set and check whether the top character and current character form a pair.
  • Can this be done in place? Yes. Use the input string as a character array and maintain a write index as the stack top.
  • Why does one scan handle newly exposed pairs? After a removal, later characters are checked against the updated stack, so newly adjacent characters are handled as the scan continues.
CodingEasyBoltSoftware Engineer

4. Best Time to Buy and Sell Stock (LeetCode)

Model answer

The task

Given daily stock prices, find the greatest profit possible from one buy followed by one later sale. If no sale would make money, return zero.

Key idea

As we scan the prices, keep the lowest price seen so far. Treat each current price as a possible sale and update the best profit using the difference from that minimum.

Approach

  1. Initialize the minimum price to a value larger than any price and the best profit to zero.
  2. Visit each price in order.
  3. Update the minimum price with the current price.
  4. Check the profit from selling today and update the best profit.
  5. Return the best profit.
class Solution:
    def maxProfit(self, prices: list[int]) -> int:
        min_price = float("inf")
        best_profit = 0

        for price in prices:
            # The current price can be a new best day to buy.
            min_price = min(min_price, price)

            # Or it can be the day to sell after the cheapest earlier buy.
            best_profit = max(best_profit, price - min_price)

        return best_profit

Complexity:

  • Time: O(n), where n is the number of prices; each is processed once.
  • Space: O(1), since only a few variables are stored.

Common follow-ups

  • What if multiple buy-and-sell transactions are allowed? Sum the gains from every adjacent price increase.
  • What if a transaction fee is charged? Track the best holding and non-holding profits, incorporating the fee when selling.
  • What if at most k transactions are allowed? Use dynamic programming over the number of completed transactions and whether a share is currently held.
CodingEasyBoltSoftware Engineer

5. Check if All Characters Have Equal Number of Occurrences (LeetCode)

Model answer

The task

Given a string, determine whether every distinct character in it appears the same number of times.

Key idea

Count each character, then check whether all counts match. There is no need to compare characters that do not appear.

Approach

  1. Count the occurrences of each character.
  2. Collect the distinct frequencies.
  3. Return True if there is only one frequency; otherwise return False.
from collections import Counter

class Solution:
    def areOccurrencesEqual(self, s: str) -> bool:
        counts = Counter(s)
        return len(set(counts.values())) == 1

Complexity:

  • Time: O(n), to count the characters in the string.
  • Space: O(k), for the counts of k distinct characters.

Common follow-ups

  • What if the string is empty? The code returns False, since there are no character counts to compare.
  • Can this be done with a fixed-size array? Yes, if the character set is known and small, use an array indexed by character.
  • What if counts may differ by at most one? Compute the minimum and maximum frequencies and check that their difference is at most one.
CodingMediumBoltSoftware Engineer

6. Get Watched Videos by Your Friends (LeetCode)

Model answer

The task

Given a friendship graph and each person’s watched videos, find the people exactly level friendship steps from a starting person. Return their videos ordered first by how often each title appears, then alphabetically for ties.

Key idea

Use breadth-first search to reach the requested distance without processing deeper levels. Count titles only among people at that distance, then sort by (count, title).

Approach

  1. Start BFS from the given person and mark them visited.
  2. Expand the queue one level at a time, tracking the current layer’s size.
  3. Stop after reaching the requested level.
  4. Count video titles for everyone in the remaining queue.
  5. Sort titles by frequency and then alphabetically.
from collections import Counter, deque
from typing import List

class Solution:
    def watchedVideosByFriends(
        self,
        watchedVideos: List[List[str]],
        friends: List[List[int]],
        id: int,
        level: int,
    ) -> List[str]:
        if level == 0:
            return []

        queue = deque([id])
        visited = {id}

        # Expand exactly one friendship layer per iteration.
        for _ in range(level):
            for _ in range(len(queue)):
                person = queue.popleft()
                for friend in friends[person]:
                    if friend not in visited:
                        visited.add(friend)
                        queue.append(friend)

        counts = Counter()
        for person in queue:
            counts.update(watchedVideos[person])

        return sorted(counts, key=lambda title: (counts[title], title))

Complexity:

  • Time: O(V + E + T + U log U), where V and E cover the explored graph, T is the number of videos counted, and U is the number of distinct titles.
  • Space: O(V + U) for the BFS state and title counts.

Common follow-ups

  • What if the friendship graph is directed? Traverse only the outgoing links supplied by the graph.
  • How would you handle very large video lists? Count titles incrementally while processing people at the target level.
  • What if results should be ordered only alphabetically? Sort the distinct titles by name instead of by (count, title).
CodingMediumBoltSoftware Engineer

7. Subarray Sum Equals K (LeetCode)

Model answer

The task

Count the contiguous subarrays whose elements sum to a given target k. The array may contain negative numbers, so subarray sums do not necessarily grow as the subarray gets longer.

Key idea

For each position, let prefix be the sum of all elements seen so far. A subarray ending here sums to k exactly when an earlier prefix sum equals prefix - k. Keep counts of earlier prefix sums in a hash table.

Approach

  1. Start with prefix sum 0 occurring once, representing the empty prefix.
  2. Scan the array and add each value to the running prefix sum.
  3. Add the number of times prefix - k has appeared to the answer.
  4. Record the current prefix sum for future positions.
from collections import defaultdict
from typing import List

class Solution:
    def subarraySum(self, nums: List[int], k: int) -> int:
        # Counts of prefix sums seen so far.
        prefix_counts = defaultdict(int)
        prefix_counts[0] = 1

        prefix_sum = 0
        subarray_count = 0

        for value in nums:
            prefix_sum += value

            # Each matching earlier prefix identifies one subarray
            # ending at the current position.
            subarray_count += prefix_counts[prefix_sum - k]

            # Record this prefix only after counting, so the match
            # refers to an earlier position.
            prefix_counts[prefix_sum] += 1

        return subarray_count

Complexity: Time: O(n), where n is the number of elements; each element is processed once.

Complexity: Space: O(n) in the worst case, for the distinct prefix sums stored.

Common follow-ups

  • Why not use a sliding window? Negative values break the monotonic behavior of window sums that sliding-window techniques rely on.
  • What if all values are nonnegative? A sliding window can be used, though prefix sums still provide a straightforward solution.
  • Can this count subarrays for many target values? The prefix-frequency scan is target-specific; repeated queries may need a different strategy depending on the input size and query count.
CodingMediumBoltSoftware Engineer

8. Find the first non-repeating character in a string.

Model answer

function firstNonRepeatingCharacter(text) {
  const counts = new Map();

  // Count Unicode code points, rather than UTF-16 code units.
  for (const character of text) {
    counts.set(character, (counts.get(character) ?? 0) + 1);
  }

  // Scan in input order so the first unique character is returned.
  for (const character of text) {
    if (counts.get(character) === 1) {
      return character;
    }
  }

  return null; // No character occurs exactly once.
}
  • Count each character, then scan the original string to preserve its order.
  • Return null if no character is unique.

Complexity: O(n) time and O(k) space, where k is the number of distinct characters.

CodingMediumBoltSoftware Engineer

9. Reverse a linked list.

Model answer

class ListNode {
  constructor(value, next = null) {
    this.value = value;
    this.next = next;
  }
}

function reverseList(head) {
  let previous = null;
  let current = head;

  while (current !== null) {
    const nextNode = current.next; // Save the rest of the list before changing the link.
    current.next = previous;
    previous = current;
    current = nextNode;
  }

  return previous; // The old tail is now the head.
}
  • Walk through the list once, reversing each next pointer in place.
  • Return the previous node after the loop; it is the new head.

Complexity: O(n) time and O(1) extra space.

Product & growthHardBoltProduct ManagerTask

10. How would you sell airline tickets?

Model answer

Clarify & scope

I’d first clarify whether “sell airline tickets” means building a new booking product, improving an existing funnel, or growing a specific market. I’ll assume we’re designing an online product that helps travelers discover, compare, and book flights, while earning revenue through commissions or partner economics. The key promise is not just finding a low fare; it’s helping customers book the right trip with confidence and no unpleasant surprises.

User segments & pain points

I’d start with price-sensitive leisure travelers booking in advance. They compare many options, often across dates and airlines, and can lose trust when baggage fees, restrictions, or the final price appear late. Business travelers are another segment, but their needs—flexibility, policy compliance, and receipts—suggest a different experience.

Goals & success metrics

My North Star would be completed, successful bookings per qualified flight search, with customer value measured alongside conversion. Guardrails would include cancellation and refund rates, support contacts per booking, price changes between search and checkout, payment failures, and customer satisfaction. A conversion increase that comes from hiding fees or selling unsuitable fares is not success.

Solutions

I’d consider three improvements:

  • Make comparison useful: show total price, duration, stops, baggage, and change rules consistently in search results.
  • Reduce search effort: offer flexible-date and nearby-airport options, with clear filters and sorting.
  • Build booking confidence: revalidate fare and availability before payment, explain the final price, and provide clear confirmation and support after purchase.

Recommendation: I’d prioritize transparent comparison and reliable checkout. These address the biggest trust and abandonment points, and create a strong foundation before investing in more advanced personalization.

flowchart LR
    A[Search route and dates] --> B[Compare total price and rules]
    B --> C[Select flight]
    C --> D[Revalidate fare and availability]
    D --> E[Enter passenger and payment details]
    E --> F[Confirm booking]
    F --> G[Send itinerary and support options]
Diagram

Prioritization & trade-offs

I’d rank ideas by customer impact, reach, confidence, and effort. Fare transparency is likely high impact and broadly applicable; flexible-date exploration may also help but can require more inventory and pricing work. I’d avoid optimizing solely for commission because ranking incentives can conflict with traveler trust. Sponsored placements, if used, should be clearly labeled and not obscure relevant results.

MVP, measurement & rollout

I’d launch with one market and a reliable set of airline or travel-supplier integrations. The MVP would support route/date search, comparable total prices, fare-rule disclosure, fare revalidation, secure payment, and booking confirmation. I’d instrument each funnel step and run an experiment against the current experience, monitoring completed bookings and the guardrails above. I’d expand only when booking reliability, customer outcomes, and unit economics hold up across devices and traffic sources.

System designHardBoltSoftware EngineerSystem design interview

11. Design a ride-matching system for millions of drivers and riders.

Model answer

1. Requirements & scale

Functional requirements

  • Accept ride requests with pickup, destination, vehicle type, and optional constraints.
  • Find nearby eligible drivers, send offers, and assign at most one driver to a ride.
  • Track driver availability and location; notify both parties of match status.
  • Support cancellation, timeout, and rematching.

Non-functional requirements

  • Matching should usually begin within a few seconds; location should be fresh enough for safe pickup ETAs.
  • Prevent double assignment, tolerate regional failures, and degrade gracefully if location or routing is delayed.
  • Protect precise location data and retain it only as long as operationally necessary.

Scale assumptions

  • Assume 10 million registered drivers, with 1 million online at peak, each publishing location every 3 seconds: about 333,000 location updates/s.
  • Assume 100 million rides/day: about 1,160 requests/s average, or 10,000/s peak at a 9x factor.
  • At roughly 150 bytes per location update, raw ingress is about 50 MB/s before protocol and replication overhead. Keep live locations in memory; persist ride and trip state, not every GPS point.

2. High-level architecture

flowchart TD
  subgraph Client["Client"]
    R["Rider app"]
    D["Driver app"]
  end
  subgraph Edge["Edge/CDN"]
    E["API gateway and websocket edge"]
  end
  subgraph LB["Load Balancer"]
    L["Regional load balancer"]
  end
  subgraph Services["API / Services"]
    API["Ride API"]
    LOC["Location ingestion"]
    MATCH["Matching service"]
    TRIP["Trip state service"]
  end
  subgraph Cache["Cache"]
    GEO["Live driver index by H3 cell"]
    LOCK["Assignment reservation cache"]
  end
  subgraph Stores["Datastores"]
    SQL["Trip database"]
    HIST["Location and audit store"]
  end
  subgraph Queue["Message Queue"]
    Q["Ride and location events"]
  end
  subgraph Workers["Workers"]
    ETA["ETA and ranking workers"]
    PUSH["Offer and notification workers"]
  end
  R -->|"request ride"| E
  D -->|"location and availability"| E
  E --> L --> API
  E --> LOC
  LOC -->|"fresh location"| GEO
  LOC -->|"asynchronous events"| Q
  API -->|"search request"| MATCH
  MATCH -->|"nearby candidates"| GEO
  MATCH --> ETA
  MATCH -->|"reserve driver"| LOCK
  MATCH -->|"create trip"| TRIP
  TRIP --> SQL
  TRIP --> Q
  Q --> PUSH
  PUSH -->|"offer and status"| E
  Q --> HIST
  E -->|"ride updates"| R
  E -->|"ride updates"| D
Diagram

3. API design

  • POST /v1/rides — create a ride request; require an idempotency key.
  • PUT /v1/drivers/me/location — submit coordinates, heading, timestamp, and availability; use a streaming connection for frequent updates.
  • POST /v1/rides/{ride_id}/accept — accept an offer with an offer token and expiry.
  • POST /v1/rides/{ride_id}/cancel — cancel with actor and reason.
  • GET /v1/rides/{ride_id} — retrieve current state; websocket events provide low-latency updates.

4. Data model & storage

  • Redis Cluster holds each available driver's latest location, state, and heartbeat. Index drivers by H3 cell at a resolution appropriate for the city; query the pickup cell and expanding neighbors. Expire stale entries after a short TTL.
  • SQL database stores durable rides, assignments, and state transitions. A ride has ride_id, rider_id, pickup/destination, status, timestamps, and version. Assignments have a unique constraint on ride_id; driver availability is also conditionally updated so one driver cannot be assigned twice.
  • Partition trip records by region and time, while preserving a stable ride ID for lookups. Store sampled location history and audit events in a durable event/object store with retention controls.
  • A queue carries location, ride, and assignment events to decouple ingestion, analytics, and notifications from the synchronous matching path.

5. Deep dive

The main challenge is finding a good driver quickly without creating conflicting assignments. I would use a two-stage search: retrieve a bounded candidate set from nearby H3 cells, then rank candidates using pickup ETA, driver state, vehicle eligibility, and marketplace fairness. Use a routing/ETA service for the top candidates rather than computing expensive routes for every nearby driver. Expand the search radius if no suitable driver is found, and stop when a configured time or distance limit is reached.

Offers should be sent to a small batch of drivers, not broadcast to every nearby driver. A short offer TTL and an explicit state machine (SEARCHING → OFFERED → ASSIGNED, with cancellation and timeout transitions) make retries understandable. The winner is selected through an atomic conditional write in the trip database or a transactionally enforced reservation; Redis can reduce contention but must not be the sole authority for a durable assignment. Late accepts receive a rejection and the next candidate is offered the ride.

sequenceDiagram
  participant R as Rider
  participant M as Match service
  participant G as Geo index
  participant T as Trip store
  participant W as Offer worker
  participant D as Driver
  R->>M: Create ride with idempotency key
  M->>G: Query pickup cell and neighbors
  G-->>M: Nearby eligible drivers
  M->>M: Rank by ETA and constraints
  M->>W: Send expiring offers to small batch
  W->>D: Offer ride
  D->>M: Accept with offer token
  M->>T: Conditional assignment transaction
  T-->>M: Assignment committed or conflict
  M-->>R: Matched or continue search
Diagram

6. Scale, bottlenecks & trade-offs

  • Location write volume: shard the in-memory index by region and cell; coalesce updates and discard out-of-order timestamps. Apply backpressure and prioritize availability/heartbeat updates over low-value GPS samples. Stale drivers are excluded rather than served from old data.
  • Hot areas: popular downtown cells can overload a shard. Split hot cells, use per-cell partitions, and cap candidate reads. Geographic partitioning improves locality but complicates trips crossing regions; route each request to its pickup region.
  • Consistency: location is eventually consistent and can be a few seconds old. Assignment is strongly consistent because double booking is unacceptable. If the trip store is unavailable, stop new assignments in that region rather than claim a match that cannot be committed.
  • Resilience: replicate regional services and Redis; use queue retention and replay for downstream events. Keep matching stateless where possible and fail over carefully so a regional outage does not cause duplicate offers or assignments.
  • Trade-off: batching offers improves driver utilization and reduces notification load, but increases match latency. Tune batch size and timeout by market, and measure pickup ETA, time-to-match, acceptance rate, cancellation rate, and assignment conflicts.
System designHardBoltSoftware EngineerSystem design interview

12. Design a real-time surge pricing system for ride-hailing.

Model answer

1. Requirements & scale

Functional requirements

  • Estimate demand and available driver supply by geographic zone; calculate a surge multiplier and return a fare quote.
  • Update prices as conditions change, while keeping a quote stable for a short booking window.
  • Support city-specific policies: minimum/maximum multipliers, rounding, and exceptions for events or emergencies.
  • Provide monitoring and an audit trail for price decisions and manual overrides.

Non-functional requirements

  • Quote latency below 100 ms at p99; use a safe fallback if pricing inputs are stale or unavailable.
  • Prices should be consistent within a zone and change smoothly, not oscillate with every event.
  • Scale globally, isolate country-specific policy, and make pricing decisions explainable.

Back-of-the-envelope estimates

  • Assume 10 million quote requests/day: about 116 QPS average, or roughly 1,200 QPS at a 10× peak. Design for 10,000 QPS to allow growth and uneven city traffic.
  • If 5 million active drivers send a location update every 5 seconds, that is 1 million updates/second. Filter and aggregate these at the edge/stream layer rather than writing every ping to the pricing database.
  • With 20,000 active zones updated every 10 seconds, pricing needs about 2,000 zone evaluations/second. At 1 KB per zone state, a full in-memory state is only about 20 MB per region.

2. High-level architecture

flowchart TD
  subgraph Client
    R["Rider app"]
    D["Driver app"]
  end
  subgraph Edge["Edge/CDN"]
    E["API gateway and regional routing"]
  end
  subgraph LB["Load Balancer"]
    L["Regional load balancer"]
  end
  subgraph API["API / Services"]
    Q["Quote service"]
    P["Pricing policy service"]
    G["Zone and geo service"]
  end
  subgraph Cache["Cache"]
    C["Redis zone price state"]
  end
  subgraph DB["Datastores"]
    S["SQL policy and audit store"]
    T["Time-series aggregates"]
  end
  subgraph MQ["Message Queue"]
    K["Kafka trip and supply events"]
  end
  subgraph Workers["Workers"]
    A["Location and trip aggregators"]
    X["Zone price calculator"]
  end
  R -->|"quote request"| E --> L --> Q
  Q -->|"zone lookup"| G
  Q -->|"current price"| C
  Q -->|"policy lookup"| P --> S
  D -->|"driver location and availability"| E --> K
  K --> A --> T
  K --> X
  T -->|"demand and supply windows"| X
  X -->|"versioned zone price"| C
  X -->|"decision audit"| S
  Q -->|"fare quote"| R
Diagram

3. API design

  • POST /v1/quotes — origin, destination, product, and currency; returns fare breakdown, multiplier, price_version, and expires_at.
  • POST /v1/trips — quote ID and idempotency key; books against the quote if it has not expired.
  • POST /v1/driver/location — authenticated, batched location and availability updates.
  • GET /v1/pricing/zones/{zone_id} — internal diagnostic endpoint for current state and freshness.
  • PUT /v1/admin/pricing/policies/{city} — authorized, audited policy changes and emergency caps.

4. Data model & storage

  • Redis: regional cache keyed by city_id:zone_id:product; value includes multiplier, computed fare inputs, valid_until, and version. Replicate across availability zones.
  • Kafka: partition supply/trip events by city_id:zone_id to preserve useful local ordering without creating one global bottleneck.
  • Time-series store: short-window counts and historical demand/supply features for monitoring and tuning.
  • SQL: durable city policies, product rules, overrides, and immutable pricing decision audit records. Keep policy versions so a quote can be reproduced.
  • Driver presence can live in a geo-indexed, short-TTL store; the pricing pipeline consumes aggregated counts, not raw coordinates long-term.

5. Deep dive

I would price a zone using a smoothed demand-to-supply ratio, rather than letting each incoming request directly change the price. For each zone and product, the stream processor maintains requests and available drivers over short windows, for example 1 minute and 5 minutes. A basic pressure value is r = requests / max(available_drivers, ε). Compare it with a city-calibrated target ratio, then map it to a multiplier with bounded growth, for example m_target = clamp(1 + k * max(0, r / r_target - 1), 1, m_max).

Smooth this target with an exponential moving average, m_t = α m_target + (1 - α) m_(t-1), and limit the change per interval. This damps noise and avoids a price whipsaw when a few drivers move across a zone boundary. Use hysteresis for entering and leaving surge, and apply policy caps after the calculation. The exact coefficients should be calibrated by city using simulations and controlled experiments; the formula is a starting point, not a universal elasticity model.

The quote service reads a versioned zone price from Redis, combines it with route distance, duration, product base fare, and local taxes, then returns a short-lived quote. At booking, validate the quote ID and expiry; do not silently reprice a rider who accepts a valid quote. If the cache is missing or stale, use the last known price only within a strict freshness limit; otherwise return a conservative non-surge fallback or a retryable error, depending on local policy. Emit the decision inputs and policy version asynchronously for audit and model evaluation.

sequenceDiagram
  participant D as Driver app
  participant K as Event stream
  participant W as Zone aggregator
  participant C as Price cache
  participant R as Rider app
  participant Q as Quote service
  D->>K: Location and availability event
  K->>W: Ordered zone event
  W->>W: Update rolling counts and smooth multiplier
  W->>C: Write price version with expiry
  R->>Q: Request quote for route
  Q->>C: Read zone price and freshness
  C-->>Q: Multiplier and version
  Q-->>R: Fare quote and expiry
Diagram

6. Scale, bottlenecks & trade-offs

  • Partition event processing by city and zone; scale consumers horizontally. Hot zones can be split by event type and recombined in the aggregator, while preserving a single authoritative price writer per zone.
  • Cache pricing state regionally and replicate it across zones. A regional outage should fail over to another region with bounded stale reads, not block all quoting on a global database.
  • Kafka gives durable, replayable event processing but introduces lag. Track event-time freshness and expose it in metrics; stale input must trigger fallback behavior, not a falsely confident surge.
  • Use eventual consistency for aggregate counts, but strong validation for the accepted quote and policy version. This balances availability and low latency against perfectly current supply data.
  • Guard against gaming, location spoofing, and unfair outcomes with anomaly detection, rate limits, policy caps, monitoring by neighborhood, and auditable overrides. Price increases should be tested against both marketplace health and rider impact, not only conversion.
System designHardBoltSoftware EngineerSystem design interview

13. Build a notification service that supports multiple channels, including push, SMS, and email.

Model answer

1. Requirements & scale

Functional requirements

  • Accept product and transactional notifications and deliver through push, SMS, or email.
  • Support templates, localization, user preferences, consent, scheduling, priority, and delivery status.
  • Retry transient failures, deduplicate requests, and expose delivery outcomes to callers.

Non-functional requirements

  • Durable acceptance, low latency for time-sensitive events, and independent scaling by channel and region.
  • Respect opt-outs, quiet hours, provider limits, and privacy requirements; avoid sending the same logical notification twice.
  • Make provider failures observable and prevent retries from creating a retry storm.

Scale assumptions

  • Assume 100 million notifications/day, about 1,160/s average and 12,000/s peak. A campaign can create a larger burst, so admission control and queueing are required.
  • At 1 KB per notification record, 100 million records/day is about 100 GB/day raw, or 36.5 TB/year before indexes and replication. Apply retention and archive delivery history.
  • A notification may fan out to several channel attempts, so capacity planning should use attempts per notification, not just API request volume.

2. High-level architecture

flowchart TD
  subgraph Client["Client"]
    APP["Bolt apps"]
    BIZ["Product services"]
  end
  subgraph Edge["Edge/CDN"]
    GW["API gateway"]
  end
  subgraph LB["Load Balancer"]
    LB1["Regional load balancer"]
  end
  subgraph Services["API / Services"]
    API["Notification API"]
    PREF["Preference and consent service"]
    RENDER["Template and rendering service"]
    ROUTE["Channel router"]
    STATUS["Status API"]
  end
  subgraph Cache["Cache"]
    PC["Preference and template cache"]
    IDEM["Idempotency cache"]
  end
  subgraph Stores["Datastores"]
    DB["Notification database"]
    OBJ["Archived delivery records"]
  end
  subgraph Queue["Message Queue"]
    Q["Priority channel queues"]
    DLQ["Dead-letter queue"]
  end
  subgraph Workers["Workers"]
    PW["Push workers"]
    SW["SMS workers"]
    EW["Email workers"]
    CB["Callback and retry workers"]
  end
  subgraph Providers["External providers"]
    PUSH["Push providers"]
    SMS["SMS providers"]
    EMAIL["Email providers"]
  end
  BIZ -->|"send request"| GW --> LB1 --> API
  API -->|"check rules"| PREF
  PREF --> PC
  API -->|"render and route"| RENDER --> ROUTE
  API -->|"idempotency and record"| IDEM
  API --> DB
  ROUTE -->|"channel jobs"| Q
  Q --> PW --> PUSH
  Q --> SW --> SMS
  Q --> EW --> EMAIL
  PUSH -->|"receipts"| CB
  SMS -->|"delivery callbacks"| CB
  EMAIL -->|"delivery callbacks"| CB
  CB --> DB
  Q --> DLQ
  STATUS --> DB
  DB --> OBJ
  APP -->|"preference updates"| GW
Diagram

3. API design

  • POST /v1/notifications — submit event_type, recipient_id, template variables, requested channels, priority, and an idempotency key; return a notification ID once durably accepted.
  • GET /v1/notifications/{id} — retrieve aggregate and per-channel status.
  • PUT /v1/users/me/notification-preferences — update channel preferences, categories, and quiet hours.
  • POST /v1/provider-callbacks/{provider} — receive signed delivery receipts; verify signatures and deduplicate callbacks.
  • Internal: POST /v1/templates/{template_id}/preview for authorized template validation and localization checks.

4. Data model & storage

  • Store notification metadata in a relational database: notification_id, tenant/event, recipient, template version, priority, idempotency key, created time, and aggregate status. Enforce uniqueness on (tenant_id, idempotency_key).
  • Store a channel_delivery row per channel attempt with provider, attempt number, provider message ID, status, next retry time, and error category. Partition by creation date and tenant or region.
  • Use a durable queue partitioned by channel and priority. Queue messages contain IDs and minimal routing data, not sensitive message bodies. Workers load the record and render or retrieve encrypted payloads as needed.
  • Cache preferences and approved template versions with short, invalidatable TTLs. Keep durable consent and preference state in the database; use an object store for older delivery history.

5. Deep dive

Treat acceptance, delivery, and user-visible delivery as separate states. The API first validates the event, recipient, preference/consent rules, and idempotency key. It commits a notification record and an outbox event in the same database transaction. An outbox publisher then enqueues work, avoiding the failure mode where the database commits but queue publication is lost. Workers claim jobs with bounded concurrency and per-provider rate limits, render a versioned template, and submit to a provider with a stable attempt identifier.

Delivery is generally at least once: queues and providers can time out after accepting a request, making the outcome ambiguous. Use provider idempotency keys where available; otherwise record the attempt before sending, reconcile callbacks, and make duplicate sends rare but explicit in the product's tolerance. Retry only transient errors with exponential backoff and jitter, honoring Retry-After; permanent failures such as invalid addresses should stop. After a bounded number of attempts, move the job to a dead-letter queue and alert operators. A provider circuit breaker and secondary provider can help, but failover should not blindly resend an ambiguous request.

sequenceDiagram
  participant P as Product service
  participant N as Notification API
  participant D as Database and outbox
  participant Q as Channel queue
  participant W as Channel worker
  participant V as Provider
  P->>N: Submit event and idempotency key
  N->>D: Validate rules and commit notification plus outbox
  D-->>N: Durable acceptance
  N-->>P: Return notification ID
  D->>Q: Publish channel job
  Q->>W: Deliver job
  W->>V: Send with attempt ID
  V-->>W: Accepted or transient failure
  V-->>D: Later delivery callback
  W->>D: Update attempt status
Diagram

6. Scale, bottlenecks & trade-offs

  • Burst handling: queue per-channel work, prioritize safety and ride-critical messages over marketing, and enforce tenant quotas. Queue age is a key SLO; autoscale workers based on backlog and provider rate limits, not CPU alone.
  • Provider limits and outages: use token-bucket rate limits, circuit breakers, provider health dashboards, and carefully controlled fallback providers. Email and SMS have different economics and delivery semantics; do not treat a provider's “accepted” response as proof of delivery.
  • Consistency: preference changes should be checked close to send time for non-urgent messages, not only at enqueue time. This can race with a worker already sending; define and document that boundary. Consent and opt-outs must override marketing requests.
  • Reliability trade-off: synchronous provider calls make API latency and availability depend on external vendors. Accepting durably and sending asynchronously gives callers a fast response and isolates outages, at the cost of delivery delay.
  • Operations and safety: monitor enqueue-to-send latency, success by channel/provider, retry and DLQ rates, opt-out enforcement, and duplicate rate. Encrypt PII, restrict access to message content, retain only what is needed, and support auditability without logging secrets or full message bodies.
System designHardBoltSoftware EngineerSystem design interview

14. How would you design a service that aggregates restaurant menus across multiple countries?

Model answer

1. Requirements & scale

Functional requirements

  • Ingest restaurant and menu data from partner APIs, files, and operator tools across multiple countries.
  • Normalize restaurants, menus, items, options, prices, hours, and availability while preserving the source data and provenance.
  • Serve localized restaurant discovery and menu reads with the correct language, currency, tax treatment, and country-specific dietary/allergen information.
  • Propagate partner updates quickly and handle corrections, outages, and menu version history.

Non-functional requirements

  • Menu reads should be highly available and typically complete within 200 ms at p99.
  • Prevent stale or invalid prices from being presented as authoritative; show update time and availability where appropriate.
  • Isolate country-level regulation and partner failures. Support auditability, access control, and data residency where required.

Back-of-the-envelope estimates

  • Assume 1 million restaurants across markets, 100 items each: 100 million menu items. At 2 KB of normalized data per item, that is about 200 GB before indexes and versions; plan for roughly 0.5–1 TB of primary and indexed data.
  • At 10 million menu reads/day, average read load is about 116 QPS; a 10× peak is 1,200 QPS. Search and popular city traffic can create much higher local hotspots, so design for 10,000 QPS globally.
  • If each restaurant sends 10 updates/day, the ingestion average is about 116 updates/second, with partner batch imports creating bursts. Queue-based ingestion absorbs those bursts without slowing menu reads.

2. High-level architecture

flowchart TD
  subgraph Client
    U["Rider app"]
    O["Restaurant operator portal"]
  end
  subgraph Edge["Edge/CDN"]
    E["Localized API gateway"]
  end
  subgraph LB["Load Balancer"]
    L["Regional load balancer"]
  end
  subgraph API["API / Services"]
    M["Menu read service"]
    S["Restaurant search service"]
    I["Ingestion and validation service"]
    N["Normalization service"]
  end
  subgraph Cache["Cache"]
    C["Redis menu cache"]
    F["CDN image cache"]
  end
  subgraph DB["Datastores"]
    R["SQL canonical catalog"]
    X["Search index"]
    B["Object storage raw feeds"]
  end
  subgraph MQ["Message Queue"]
    K["Kafka catalog events"]
  end
  subgraph Workers["Workers"]
    V["Validation and enrichment"]
    P["Index and cache publishers"]
  end
  U -->|"localized browse and menu reads"| E --> L --> M
  E --> L --> S
  M -->|"menu snapshot"| C
  S -->|"geo and text query"| X
  O -->|"edits and corrections"| E --> I
  I -->|"partner feeds"| B
  I --> K --> V --> N --> R
  R -->|"catalog change event"| K
  K --> P --> X
  P -->|"invalidate or refresh"| C
  M -->|"image URLs"| F
  M --> U
Diagram

3. API design

  • GET /v1/restaurants?lat=&lng=&locale=&country=&cursor= — discover restaurants available to the user.
  • GET /v1/restaurants/{restaurant_id}/menu?locale=&currency= — return a localized, versioned menu and availability timestamp.
  • POST /v1/partner/catalog/imports — create an idempotent feed import and return an import ID for status checks.
  • GET /v1/partner/catalog/imports/{import_id} — report validation errors and publish status.
  • PATCH /v1/partner/restaurants/{restaurant_id}/items/{item_id} — authorized operator correction with an expected version to avoid lost updates.
  • POST /v1/internal/catalog/events — internal event ingestion where partners use push integrations.

4. Data model & storage

  • SQL canonical catalog: Restaurant, Menu, MenuSection, Item, ModifierGroup, ModifierOption, LocalizedText, Price, OpeningHours, and SourceMapping. Store partner IDs and country/market ownership explicitly.
  • Versioning: each published menu has a monotonically increasing menu_version; retain source payload, normalized version, validation status, and change timestamp. Use an audit table or append-only event log for changes.
  • Partitioning: partition catalog data by country or market for residency and operational isolation. Shard large item tables by restaurant_id; keep a country-to-region routing directory.
  • Search index: denormalized documents for restaurant name, cuisine, geo location, open status, and relevant item text. It is a derived index, not the source of truth.
  • Redis/CDN: cache popular menu snapshots and images with versioned keys. Use short TTLs for availability and prices, longer TTLs for stable descriptions.
  • Object storage: preserve raw partner files and large images for replay, debugging, and audit.

5. Deep dive

The difficult part is not displaying a menu; it is reconciling inconsistent partner data without accidentally publishing a broken catalog. I would build a country-aware ingestion pipeline with adapters per partner. Each adapter converts the source format into a common staging schema while retaining raw values, source IDs, and provenance. Normalization maps partner identifiers to canonical restaurant and item IDs, resolves locale and currency, and applies market-specific rules such as required allergen fields or tax-inclusive price handling.

Validation should be explicit and staged. Reject structurally invalid records, quarantine ambiguous mappings, and flag suspicious changes such as a price changing by 10× or a feed removing most items. Do not replace a healthy published menu with a failed partial import. For full snapshots, publish only after the import passes validation; for incremental updates, apply them idempotently using partner event IDs and expected versions. Keep tombstones for intentional removals so retries cannot resurrect deleted items.

On successful validation, write a new canonical menu version transactionally, then publish an outbox event. Consumers update the search index and invalidate or refresh cached menu snapshots. The API returns a consistent version identifier so support teams can trace what a user saw. For outages, serve the last good menu within a configured staleness window, but mark availability and prices as potentially stale or suppress checkout-sensitive fields according to local policy.

sequenceDiagram
  participant P as Partner
  participant I as Ingestion API
  participant K as Event queue
  participant V as Validator and normalizer
  participant DB as Catalog database
  participant X as Search and cache publisher
  participant A as Rider app
  P->>I: Submit feed with partner version
  I->>K: Persist import event and raw reference
  K->>V: Deliver import for processing
  V->>V: Map IDs, localize, validate, detect anomalies
  V->>DB: Publish new menu version if valid
  DB-->>K: Outbox catalog-changed event
  K->>X: Update search index and invalidate cache
  A->>X: Search restaurants
  A->>DB: Read menu through menu service and cache
Diagram

6. Scale, bottlenecks & trade-offs

  • Use at-least-once queue delivery with idempotent consumers and an outbox pattern; this avoids losing updates between a database commit and event publication. Send poison imports to a dead-letter queue with operator-visible diagnostics.
  • Keep catalog writes strongly consistent within a market, but allow search indexes and caches to converge asynchronously. Search results may lag briefly; menu reads should use the latest published canonical version when cache freshness requires it.
  • Isolate partner adapters and rate limits so one broken or slow feed cannot block other countries. Apply backpressure, per-partner quotas, retry with jitter, and circuit breakers.
  • Country partitioning helps residency and failure isolation but makes cross-country analytics harder. Export privacy-safe events to a separate analytics platform rather than querying operational databases globally.
  • Cache invalidation is a correctness risk: use versioned keys and short TTLs for changing fields, plus event-driven invalidation. On cache or search outages, serve a bounded stale menu where safe and degrade discovery gracefully.
  • Use SQL for canonical relationships and transactions, search technology for relevance and geo queries, object storage for raw or large content, and queues for burst absorption. No single datastore should be asked to solve all four problems.
TechnicalMediumBoltBackend Engineer

15. How would you diagnose and optimise a slow SQL query in production?

Model answer

  1. Confirm the impact and capture evidence. I’d identify the affected endpoint, query shape, time window, and whether the slowdown is broad or isolated. I’d compare p50, p95, and p99 latency, throughput, timeout and error rates, and database CPU, I/O, connections, and lock waits against a known-good baseline. I’d use query statistics and traces to find the actual expensive query rather than guessing from application latency alone.
  2. Inspect the query and its plan. I’d check the exact SQL, bind values, row counts, and execution plan. The plan can reveal a full table scan, an inefficient join order, repeated lookups, a sort or hash spilling to disk, or a large mismatch between estimated and actual rows. On production, I’d prefer a safe plan-inspection method; EXPLAIN ANALYZE executes the query and can add load, so I would only use it with appropriate safeguards.
  3. Check data and concurrency conditions. I’d look for stale statistics, skewed data, lock contention, connection-pool saturation, N+1 queries, and recent schema or traffic changes. A query can be fast in isolation but slow under contention or when it returns far more data than the caller needs.
  4. Make the smallest evidence-backed change. Depending on the plan, I might add a composite or covering index whose column order matches the filters and sort, rewrite a non-sargable predicate, reduce selected columns, change an inefficient join, or paginate results. For a Bolt trips query, for example, an index on (rider_id, created_at) may help if the request filters by rider and orders recent trips. I’d verify the read improvement against the write and storage cost of the index.
  5. Roll out and verify safely. I’d test correctness and performance with representative data, apply schema changes using an online method where possible, then canary or gradually roll out. I’d compare latency, resource use, and errors, and keep a rollback path. If one query cannot meet the latency target, I’d consider caching or asynchronous processing only after checking freshness and consistency requirements.
flowchart TD
    A[Slow endpoint report] --> B[Measure latency and database health]
    B --> C[Find query from traces and query stats]
    C --> D[Inspect SQL and execution plan]
    D --> E[Check locks data and statistics]
    E --> F[Choose targeted change]
    F --> G[Test and canary]
    G --> H{Metrics improve safely}
    H -->|Yes| I[Roll out and monitor]
    H -->|No| D
Diagram

I’d avoid adding indexes or rewriting SQL without measuring: each change should be tied to a plan-level cause and validated against production-like traffic.

TechnicalMediumBoltBackend Engineer

16. What happens under the hood when a client sends a request to a REST API?

Model answer

  1. The client prepares the request. It resolves the API hostname through DNS, opens a connection—typically TCP plus a TLS handshake for HTTPS—and sends an HTTP request with a method, path, headers, and, when needed, a body. The client may also attach credentials, a request ID, and an idempotency key.
  2. The request crosses the edge. A CDN or web application firewall may serve a cached response or reject malformed or abusive traffic. Otherwise, a load balancer routes the request to a healthy API instance, often using health checks and connection management.
  3. The server applies shared middleware. The API server parses the HTTP request and applies concerns such as request-size limits, rate limiting, authentication, authorization, input validation, and tracing. It should reject invalid or unauthorized requests before expensive work.
  4. The application handles the operation. A route handler calls domain logic—for example, validating a Bolt ride request, checking eligibility, and creating an order. It reads or writes databases and caches as needed. Work that does not need to finish before the response, such as sending a notification, can be placed on a queue for a worker.
  5. The server returns an HTTP response. It serializes a response body and sets a status code and headers. For example, 201 Created can indicate a successfully created resource; 400 a malformed request; 401 unauthenticated; 429 rate limited; and 5xx a server-side failure. The response travels back through the load balancer and network to the client.
flowchart TD
    A[Client] -->|HTTP request| B[DNS and TLS]
    B -->|HTTPS| C[CDN and WAF]
    C -->|Forward request| D[Load balancer]
    D -->|Route to healthy instance| E[API server]
    E --> F[Middleware]
    F -->|Validate and authorize| G[Handler and domain logic]
    G -->|Read or write| H[Cache and database]
    G -->|Enqueue noncritical work| I[Message queue]
    G -->|Status and response body| E
    E -->|HTTP response| D
    D -->|Response| A
Diagram
  1. Production concerns matter throughout. The service should enforce timeouts, propagate a trace or request ID, log useful context without exposing sensitive data, and measure latency and error rates. Retries need care: retrying a non-idempotent operation can create duplicates, so operations such as payment or order creation should use idempotency keys. The client and server should also agree on API versioning and error formats.

Practice these out loud, don't memorise them

Reading an answer is not the same as being able to give one under pressure. ChannelPulse plays the interviewer, asks the follow-ups, and scores each answer with feedback and a model answer so you can hear the gap between what you said and what lands.

Get ChannelPulse Browse all questions