PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/System Design/Meta

Design a bank system with transfers

Last updated: Mar 29, 2026

Quick Overview

This question evaluates system-design and transactional engineering skills for financial services, including API design, data modeling, correctness under holds and transfer expirations, idempotency, merge semantics, and complexity reasoning.

  • hard
  • Meta
  • System Design
  • Software Engineer

Design a bank system with transfers

Company: Meta

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: HR Screen

Design and implement a single-process BankSystem that supports the following APIs (timestamps are monotonically increasing integers; amounts are non‑negative integers). Provide data models and algorithms to satisfy the behaviors and edge cases: ( 1) bool createAccount(timestamp, customerId); ( 2) int deposit(timestamp, customerId, amount); ( 3) int pay(timestamp, sourceAccountId, targetAccountId, amount); ( 4) String transfer(timestamp, targetAccountId, amount) — returns a unique transferId and immediately places a hold on the source account’s funds; ( 5) boolean accept(timestamp, accountId, transferId); ( 6) void mergeCustomers(oldId, newId). Requirements: (a) For levels 1–3, assume one account per customer (accountId == customerId). A transfer places a hold and deducts the amount from the source at transfer time; accept within an expiry window completes the transfer by crediting the target; if a transfer expires before acceptance, the held funds must be returned to the source. (b) All balance‑mutating operations (deposit and pay) must first detect and unwind any expired transfers affecting the involved accounts so that their return values reflect the correct post‑expiration balances. (c) On successful acceptance, the transfer amount must contribute to the account’s activity metric (used by the Top‑N query); expired transfers do not. (d) Define precise return values and errors for nonexistent accounts, insufficient funds, duplicate or late accept calls, invalid/expired transferIds, and idempotency expectations. (e) mergeCustomers(oldId, newId) merges customer identities while preserving each original account’s balance and full transaction history; reassign all of oldId’s accounts and any open/held/settled transfers to newId without altering historical records. Explain your chosen data structures, the time/space complexity for each API, and how you would test long mixed operation sequences with many accounts.

Quick Answer: This question evaluates system-design and transactional engineering skills for financial services, including API design, data modeling, correctness under holds and transfer expirations, idempotency, merge semantics, and complexity reasoning.

Related Interview Questions

  • Design an Online Game Leaderboard - Meta (hard)
  • Design an Instagram-like Media Feed - Meta (medium)
  • Design an Online Judge and Live Comments - Meta (medium)
  • Design an Instagram-like platform - Meta (medium)
  • Design a Coding Contest Platform - Meta (medium)
Meta logo
Meta
Sep 6, 2025, 12:00 AM
Software Engineer
HR Screen
System Design
2
0

Single-Process BankSystem: APIs, Data Model, Algorithms, and Edge Cases

Context and Assumptions

You are asked to design and implement a single-process banking system with monotonically increasing integer timestamps and non-negative integer amounts. For levels 1–3, assume one account per customer such that accountId == customerId. Transfers place an immediate hold on the source account and have a fixed expiry window.

Note: The original transfer signature did not include the source account. To make the API unambiguous, we normalize it to transfer(timestamp, sourceAccountId, targetAccountId, amount).

Assume a fixed expiry window W (in timestamp units), configured at system initialization.

APIs to Support

  1. bool createAccount(timestamp, customerId)
  2. int deposit(timestamp, customerId, amount)
  3. int pay(timestamp, sourceAccountId, targetAccountId, amount)
  4. String transfer(timestamp, sourceAccountId, targetAccountId, amount)
    • Returns a unique transferId and immediately places a hold (deducts funds) on the source account.
  5. boolean accept(timestamp, accountId, transferId)
  6. void mergeCustomers(oldId, newId)

Requirements

(a) For levels 1–3, one account per customer (accountId == customerId). A transfer places a hold and deducts from the source at transfer time. An accept within the expiry window completes the transfer by crediting the target. If a transfer expires before acceptance, held funds are returned to the source.

(b) All balance-mutating operations (deposit and pay) must first detect and unwind any expired transfers affecting the involved accounts so return values reflect correct post-expiration balances.

(c) On successful acceptance, the transfer amount contributes to the target account’s activity metric (used by a Top‑N query). Expired transfers do not contribute.

(d) Define precise return values and error behavior for: nonexistent accounts, insufficient funds, duplicate or late accepts, invalid/expired transferIds, and idempotency expectations.

(e) mergeCustomers(oldId, newId) merges customer identities while preserving each original account’s balance and full transaction history; reassign all of oldId’s accounts and any open/held/settled transfers to newId without altering historical records. Also explain chosen data structures, time/space complexity for each API, and how to test long mixed operation sequences with many accounts.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Meta•More Software Engineer•Meta Software Engineer•Meta System Design•Software Engineer System Design
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.