PracHub
QuestionsPremiumLearningGuidesCheatsheetNEW
|Home/Coding & Algorithms/Airbnb

Design refundable transaction ledger and prioritization rules

Last updated: Mar 29, 2026

Quick Overview

This question evaluates knowledge of data structures and algorithms for transactional ledgers, including tracking payments and refundable balances, rule-based prioritization for allocating refunds, handling partial and multiple refunds, and ensuring correctness when payments and refunds interleave.

  • Medium
  • Airbnb
  • Coding & Algorithms
  • Software Engineer

Design refundable transaction ledger and prioritization rules

Company: Airbnb

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Design and implement a transaction ledger that ingests a stream of records where each record is either a payment or a refund. Each payment has {id, userId, amount, timestamp}; each refund has {id, userId, amount, timestamp, optional paymentIdReference}. ( 1) Choose data structures to store payments and track remaining refundable amounts. ( 2) Implement APIs: addPayment(payment), addRefund(refund, rules), and getUserBalance(userId). ( 3) When a refund arrives without paymentIdReference, select which prior payment(s) to offset based on a provided priority rule set (e.g., a comparator that can express recency-first, amount-first, or other tie-breakers). ( 4) Support partial refunds and multiple refunds against the same payment; ensure refunds cannot exceed a payment’s remaining refundable amount. ( 5) Input may interleave payments and refunds; for each refund, return the list of (paymentId, refundedAmount) pairs it offsets. ( 6) Analyze time and space complexity of each operation and justify your data-structure choices.

Quick Answer: This question evaluates knowledge of data structures and algorithms for transactional ledgers, including tracking payments and refundable balances, rule-based prioritization for allocating refunds, handling partial and multiple refunds, and ensuring correctness when payments and refunds interleave.

Related Interview Questions

  • Determine Exact Layover Booking - Airbnb (medium)
  • Implement Text Layout and Query Parsing - Airbnb (easy)
  • Compute board-game score from regions - Airbnb (medium)
  • Find smallest permutation under constraints - Airbnb (medium)
  • Construct smallest number from I/D pattern - Airbnb (medium)
Airbnb logo
Airbnb
Jul 16, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
20
0

Design and implement a transaction ledger that ingests a stream of records where each record is either a payment or a refund. Each payment has {id, userId, amount, timestamp}; each refund has {id, userId, amount, timestamp, optional paymentIdReference}. (

  1. Choose data structures to store payments and track remaining refundable amounts. (
  2. Implement APIs: addPayment(payment), addRefund(refund, rules), and getUserBalance(userId). (
  3. When a refund arrives without paymentIdReference, select which prior payment(s) to offset based on a provided priority rule set (e.g., a comparator that can express recency-first, amount-first, or other tie-breakers). (
  4. Support partial refunds and multiple refunds against the same payment; ensure refunds cannot exceed a payment’s remaining refundable amount. (
  5. Input may interleave payments and refunds; for each refund, return the list of (paymentId, refundedAmount) pairs it offsets. (
  6. Analyze time and space complexity of each operation and justify your data-structure choices.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Airbnb•More Software Engineer•Airbnb Software Engineer•Airbnb Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.