← Stripe Interview Insights

Stripe·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Stripe coding interview for a software engineer role, one problem that looked like a clean matching exercise but had enough edge cases to keep you honest for a while.

Questions Asked (1)

Q1

Given a list of invoices and a list of payments, each with a customer ID, write an algorithm to match payments to invoices. A match requires the same customer, equal amounts, and if multiple invoices qualify, pick the one with the earliest due date. Each invoice can only be matched once. Return the payment-to-invoice mapping plus whatever's left unmatched on both sides.

Algorithms & Data StructuresData Modeling
Author's notes

I started by grouping invoices by customer and amount, which felt right, but then I fumbled the FIFO part for a few minutes.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem constraints and edge cases, then propose an efficient algorithm using hash maps to group invoices by customer and amount, and a priority queue or sorted list to select the earliest due date. Walk through the algorithm step-by-step, analyze time and space complexity, and discuss potential optimizations or trade-offs.

Pro tip: Demonstrate awareness of real-world payment matching complexities like partial payments, multiple invoices per payment, and currency differences, and mention how your algorithm could be extended to handle them.

1. Clarify requirements and edge cases

Ask about input sizes, data types, whether amounts are in the same currency, and if there are any constraints on matching (e.g., partial payments, multiple invoices per payment). Confirm that each invoice can be matched at most once and that we need to return unmatched items.

2. Design data structures

Use a hash map to group invoices by customer ID and amount, storing them in a min-heap keyed by due date for efficient retrieval of the earliest due invoice. Track matched invoices and payments to compute unmatched lists.

3. Outline algorithm steps

Iterate through payments, for each payment look up the customer-amount key in the hash map, pop the earliest due invoice from the heap if available, record the match, and mark both as matched. After processing, collect unmatched payments and invoices.

4. Analyze complexity and discuss optimizations

State time complexity: O(P log I) where P is number of payments and I is max invoices per customer-amount group, due to heap operations. Space complexity: O(I + P). Mention potential optimizations like sorting invoices by due date per group or using a balanced BST.

5. Test with examples and edge cases

Walk through a small example, including cases with no matches, multiple matches, and ties in due dates. Discuss how to handle ties (e.g., any deterministic rule) and ensure the algorithm returns correct unmatched lists.

Key Points to Mention

  • Use of hash maps for O(1) average lookup by customer and amount.
  • Priority queue (min-heap) to efficiently get the invoice with the earliest due date.
  • Time and space complexity analysis: O(P log I) time, O(I + P) space.
  • Handling of edge cases: no matching invoices, multiple payments for same customer, ties in due dates.
  • Ensuring each invoice is matched at most once by removing it from the heap or marking as used.
  • Returning both matched mapping and unmatched lists for payments and invoices.

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