← Stripe Interview Insights

Stripe·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

Stripe SWE interview with a billing simulation problem. The core challenge was modeling a two-plan pricing system with prorated splits when a user straddles both plans in the same month. More nuance than it looks on the surface.

Questions Asked (1)

Q1

Given a list of usage records (user_id, input_tokens, output_tokens, plan), compute the total monthly cost per user. There are two plans: a pay-as-you-go plan billed per token with different rates for input vs output, and a subscription plan with a flat monthly fee covering usage up to a threshold, with any overage billed at pay-as-you-go rates. If a user appears under both plans in the same month, split the billing proportionally by usage share.

Pricing & MonetizationAlgorithms & Data StructuresSystem Design
Author's notes

The base case felt manageable.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the billing rules and edge cases first, then outline a two-pass algorithm: first aggregate usage per user per month and compute each plan's cost, then combine costs proportionally when a user has both plans. Discuss data structures, complexity, and how to handle scale and correctness.

Pro tip: Show you think about real-world billing by mentioning idempotency, auditability, and handling late-arriving records—Stripe cares deeply about correctness and money movement.

1. Clarify requirements and edge cases

Ask about exact rates, subscription fee, threshold definition (input+output tokens?), and how to handle users with zero usage or missing months. Confirm the proportional split rule and rounding.

2. Design data model and aggregation

Group records by user_id and month, summing input_tokens and output_tokens per plan. Use a hash map keyed by (user_id, month) to accumulate totals efficiently.

3. Compute cost per plan

For pay-as-you-go: cost = input_tokens * input_rate + output_tokens * output_rate. For subscription: cost = flat_fee + max(0, total_tokens - threshold) * pay_as_you_go_rate (using appropriate input/output rates for overage).

4. Combine costs for dual-plan users

If a user has both plans in a month, compute each plan's cost based on its own usage, then split the total proportionally by each plan's usage share (e.g., tokens). Ensure the sum of split costs equals total cost.

5. Discuss complexity, scale, and correctness

Analyze time O(N) and space O(U) where U is unique user-month pairs. Mention handling large datasets via streaming or MapReduce, and ensuring idempotency and audit trails.

Key Points to Mention

  • Hash map aggregation by (user_id, month) for efficient grouping
  • Clear separation of plan-specific cost calculations
  • Proportional split logic and rounding considerations
  • Time and space complexity analysis
  • Scalability: streaming, partitioning, or MapReduce for large data
  • Real-world concerns: idempotency, auditability, late-arriving data

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