← Optiver Interview Insights

Optiver·Software Engineer·Onsite - Coding / Algorithms·Intermediate

IntermediatePrefer not to say
Jul 2026

Summary

Optiver coding round focused on a flight/cargo optimization problem where you had to modify a broken greedy implementation to actually maximize profit. The follow-ups were quick and they expected you to reason out loud about constraints on the fly.

Questions Asked (2)

Q1

You're given a broken implementation that buys every available flight regardless of cost. Given a list of flights (departure time, max weight, cost) and cargo items (weight, latest arrival, revenue), modify the algorithm to select which flights to purchase and which cargo to load so that total revenue minus total flight cost is maximized, while respecting weight limits and delivery deadlines.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The starting code was deliberately unprofitable, which was a bit disorienting at first because I spent a minute just reading it trying to figure out if I was missing something.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the problem constraints and define the objective function. Then, model it as an optimization problem, likely reducible to min-cost flow or dynamic programming, and discuss algorithmic approaches with complexity analysis. Finally, address trade-offs and potential extensions.

Pro tip: Demonstrate awareness of real-world constraints like time windows and capacity, and mention how you would validate the solution with edge cases and stress tests.

1. Clarify Requirements and Constraints

Ask questions to understand the exact problem: Are flights and cargo independent? Can cargo be split? Are there multiple flights with same departure? What are the ranges of values? This ensures you solve the right problem.

2. Formalize the Optimization Problem

Define variables: binary for flight selection, binary for cargo assignment to flights. Write objective: maximize sum(revenue of delivered cargo) - sum(cost of selected flights). Constraints: weight capacity per flight, cargo delivery deadline (cargo must be on a flight departing before latest arrival), and each cargo at most once.

3. Identify Algorithmic Approach

Recognize this as a variant of the knapsack or facility location problem. Consider modeling as min-cost max-flow: source to cargo (capacity 1, cost -revenue), cargo to compatible flights (capacity 1, cost 0), flights to sink (capacity max weight, cost flight cost). Then find min-cost flow. Alternatively, use DP if constraints are small.

4. Analyze Complexity and Trade-offs

Discuss time and space complexity of the chosen approach. Compare with alternatives like greedy (not optimal) or integer programming. Mention that min-cost flow with potentials can be efficient for moderate sizes, but may be overkill for small inputs.

5. Handle Edge Cases and Extensions

Consider cases like no flights, no cargo, all cargo too heavy, deadlines impossible. Discuss how to extend to multiple legs, time-dependent costs, or stochastic arrivals.

Key Points to Mention

  • Model as min-cost flow or bipartite matching with costs
  • Objective: maximize profit (revenue - cost)
  • Constraints: weight capacity, delivery deadlines, each cargo at most once
  • Complexity: O(V^2 E) for min-cost flow, or pseudo-polynomial DP
  • Trade-offs: exact vs heuristic, scalability, real-time constraints
  • Validation: test with small cases, brute force comparison, stress testing

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

How would you handle explaining to a user why a specific flight they requested is not available, given that a competitor may have already purchased it?

System DesignAPI & Integrations
Author's notes

Felt like a system design lite question tucked into a coding interview.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the user's goal and the system's constraints, then propose a layered solution that separates user-facing messaging from backend inventory logic. Emphasize transparency, graceful degradation, and real-time data synchronization to handle competitive purchases.

Pro tip: Frame the answer around user trust and system reliability: acknowledge that competitors may buy inventory, but focus on how your design minimizes surprise and provides actionable alternatives. This shows you think beyond code to business impact.

1. Clarify the scenario and requirements

Ask clarifying questions about the system: Is this a real-time booking API? What data sources are involved? What are the latency and consistency requirements? This ensures you address the right problem.

2. Design the user-facing message

Craft a clear, empathetic message that explains the flight is no longer available, without blaming the competitor. Offer alternative flights or waitlist options to maintain user engagement.

3. Implement backend inventory checks

Use a combination of caching, real-time database queries, and possibly a reservation lock to verify availability. Handle race conditions with optimistic locking or distributed transactions.

4. Ensure system resilience and observability

Add logging, metrics, and alerts for inventory mismatches. Design fallbacks (e.g., retry with exponential backoff) and consider eventual consistency trade-offs.

5. Iterate based on feedback

Propose A/B testing different messages and monitoring user behavior. Use data to refine the balance between accuracy and user experience.

Key Points to Mention

  • Real-time inventory synchronization and race condition handling
  • User experience: clear communication and alternative options
  • API design: idempotency, error codes, and rate limiting
  • System scalability and low-latency requirements (relevant to Optiver's trading context)
  • Observability: logging, metrics, and alerting for inventory discrepancies
  • Trade-offs between consistency, availability, and user trust

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.