Problem 1 — Ticket Reservation API Design
Codewriting
How do you design the API/backend for a ticket reservation app?
Examples include movie tickets or concert tickets.
The app should allow users to hold their ticket(s) for 10 minutes before booking.
- Execution time limit: 2 seconds (plaintext)
- Memory limit: 1 GB
Problem 2 — Third-Party Airline Booking APIs
3-party APIs
Suppose we want to design an automated flight-booking service for our clients.
Our job is to book the cheapest flight for a given origin, destination, and departure date.
We can get flight data and create bookings using many different third-party Airline booking APIs.
题目 1:票务预订系统(10 分钟保留机制)
核心思路:
- 核心对象:Seat / Hold / Reservation
- seat 状态:available / held / booked
- held 需要自动过期(10 分钟)
- 关键组件
- Hold Manager(保存 hold 并负责 TTL 自动过期)
- Reservation Manager(真正付款后转 booked)
- Distributed Lock / Atomic Check 防超卖
- Background Cleanup Job 清除过期 hold
- 关键 API 设计
POST /hold保留座位 → 返回 holdId(含过期时间)POST /reserve根据 holdId 完成购买DELETE /hold/{id}放弃 hold- 查询接口:showtime seats / user holds / reservations
- 一致性
- 使用 Redis / DynamoDB / CockroachDB 做 conditional write
- 每次 hold/reserve 都要 CAP 中优先 CP
题目 2:航空机票搜索与自动预订(多第三方 API)
核心思路:
- 三个关键服务层
- Aggregation Service → 并发查询多个航空 API
- Normalization Layer → 格式标准化(价格、币种、舱位)
- Booking Orchestrator → 多步骤预订流程(锁舱 / 出票 / 失败回滚)
- 查询流程
- 并发请求多个 API
- 去重 + 排序
- 取最便宜航班
- 预订流程
- Step 1: hold seat
- Step 2: confirm booking
- Step 3: fallback / rollback if error
- 可靠性
- 自动重试、超时处理、熔断
- 日志与监控 APM
VOprep 团队长期陪同学员实战各类大厂 OA 与 VO,包括 Meta、Google、Amazon 等,提供实时答案助攻、远程陪练与面试节奏提醒,帮助大家在关键时刻不卡壳。
如果你也在准备 Stripe 或类似工程向公司,可以了解一下我们的定制助攻方案——从编程面到系统设计,全程护航上岸。