← Coinbase Interview Insights

Coinbase·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

Coinbase software engineer interview with a coding question around building a Bank account class. Pretty straightforward OOP problem but the edge cases around overdraft prevention and cashback logic are where things get interesting.

Questions Asked (1)

Q1

Design and implement a BankAccount class with Deposit, Withdraw, and CashBack methods. The class should prevent overdrafts and return the updated balance after each operation.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Felt pretty confident going in since I'd done similar OOP stuff before.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and edge cases, then design a class with a private balance and methods that validate operations before updating the balance. Implement Deposit, Withdraw, and CashBack with clear error handling (e.g., throw exceptions for invalid amounts or overdrafts) and return the updated balance after each successful operation.

Pro tip: Mention that you would use a thread-safe approach (e.g., synchronized methods or locks) if the class is to be used in a concurrent environment, and discuss the trade-offs between throwing exceptions versus returning error codes.

1. Clarify Requirements

Ask about expected behavior for invalid inputs (negative amounts, overdrafts), whether CashBack is a deposit or withdrawal, and if thread safety is required.

2. Design Class Interface

Define the class with a private balance field and public methods: deposit(amount), withdraw(amount), and cashBack(amount). Specify return types (e.g., double or BigDecimal) and error handling strategy.

3. Implement Core Logic

For each method, validate the amount (e.g., must be positive), check for sufficient funds for withdrawals, update the balance, and return the new balance. Use exceptions for error cases.

4. Handle Edge Cases

Consider zero amounts, maximum balance limits, and concurrency. Discuss how to handle these (e.g., throw IllegalArgumentException, use synchronized).

5. Test and Validate

Write unit tests covering normal operations, boundary conditions, and error scenarios to ensure correctness and robustness.

Key Points to Mention

  • Encapsulation: keep balance private and provide controlled access via methods.
  • Input validation: reject negative or zero amounts for deposit/withdraw/cashback (unless specified otherwise).
  • Overdraft prevention: check sufficient balance before withdrawal and throw an exception or return an error.
  • Return updated balance after each successful operation.
  • Thread safety: discuss synchronized methods or locks for concurrent access.
  • Use of BigDecimal for monetary values to avoid floating-point precision issues.

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