PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/System Design/Meta

Design a basic bank system API

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to design and implement an in-memory banking API, focusing on data modeling, API semantics, invariants (such as monotonic timestamps and non-negative balances), idempotency, and basic concurrency control.

  • hard
  • Meta
  • System Design
  • Software Engineer

Design a basic bank system API

Company: Meta

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Take-home Project

Design and implement an in-memory bank system. Provide an interface/class BankSystem with methods: bool createAccount(long timestamp, String customerId); int deposit(long timestamp, String customerId, int amount); int pay(long timestamp, String sourceAccountId, String targetAccountId, int amount). Define the data model, invariants (e.g., no negative balances), return semantics (e.g., new balance vs. error codes), and time/space complexity. Use hash maps (not lists) for constant-time account and transaction lookups. Address edge cases: duplicate or out-of-order timestamps, insufficient funds, unknown accounts, idempotency of retries, and basic concurrency assumptions.

Quick Answer: This question evaluates a candidate's ability to design and implement an in-memory banking API, focusing on data modeling, API semantics, invariants (such as monotonic timestamps and non-negative balances), idempotency, and basic concurrency control.

Related Interview Questions

  • Design Top-K, Crawler, and Chess Systems - Meta (hard)
  • Design Search And Web Crawling Systems - Meta (medium)
  • Design an Instagram-Style Social Feed - Meta (medium)
  • Design an Online Game Leaderboard - Meta (hard)
  • Design an On-Demand Delivery Platform - Meta (medium)
Meta logo
Meta
Sep 6, 2025, 12:00 AM
Software Engineer
Take-home Project
System Design
6
0

In-Memory Bank System: API, Data Model, Invariants, Semantics, and Edge Cases

Goal

Design and implement an in-memory bank system that supports accounts, deposits, and payments/transfers. The system must be hash-map-based for O(1) average-time lookups and must define behavior for edge cases (timestamps, idempotency, unknown accounts, insufficient funds) and basic concurrency.

API

Interface/class BankSystem with these methods:

  • bool createAccount(long timestamp, String customerId)
  • int deposit(long timestamp, String customerId, int amount)
  • int pay(long timestamp, String sourceAccountId, String targetAccountId, int amount)

Requirements

  1. Data model
    • Define account and transaction structures suitable for O(1) lookups via hash maps.
  2. Invariants
    • No negative balances.
    • Per-account timestamps are monotonic (reject stale/out-of-order ops).
  3. Return semantics
    • Specify what the methods return on success and on failure (e.g., new balance vs error codes).
  4. Complexity
    • Time and space complexity for each operation.
  5. Edge cases to handle
    • Duplicate or out-of-order timestamps.
    • Insufficient funds.
    • Unknown accounts.
    • Idempotency under retries.
    • Basic concurrency assumptions.

Constraints

  • Use hash maps (not lists) for constant-time account and transaction lookups.
  • The system is in-memory (single process), but may be accessed concurrently by multiple threads.

Solution

Show

Submit Your Answer

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 8,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.