PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Coinbase

Implement bank account with cashback

Last updated: Mar 29, 2026

Quick Overview

This question evaluates implementation skills in sequential operation processing, integer arithmetic, control flow, edge-case handling, and overflow awareness within algorithmic constraints.

  • Medium
  • Coinbase
  • Coding & Algorithms
  • Software Engineer

Implement bank account with cashback

Company: Coinbase

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Implement a bank account processor. Given an initial non-negative integer balance B and a list of operations (n up to 1e 5), apply each operation in order and return the final balance. Operations are: ( 1) DEPOSIT x — add x to the balance; ( 2) WITHDRAW x — subtract x only if balance ≥ x, otherwise ignore the operation; ( 3) CASHBACK p — credit floor(balance * p / 100) to the balance. Assume all x and p are non-negative integers; use 64-bit integers to avoid overflow. Target O(n) time and O( 1) extra space. Provide unit tests for edge cases (zero amounts, multiple consecutive cashbacks, ignored withdrawals, large values). Example: B=100, ops=["DEPOSIT 50","WITHDRAW 120","CASHBACK 10","WITHDRAW 15"] → 18.

Quick Answer: This question evaluates implementation skills in sequential operation processing, integer arithmetic, control flow, edge-case handling, and overflow awareness within algorithmic constraints.

Related Interview Questions

  • Implement an In-Memory Database - Coinbase (hard)
  • Implement a Coin-Constrained Jump Strategy - Coinbase (hard)
  • Implement Game Physics and Block Mining - Coinbase (hard)
  • Compute Total Manual Distance - Coinbase (medium)
  • Implement a Flappy Bird Jump Agent - Coinbase
Coinbase logo
Coinbase
Jul 29, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
1
0

Implement a bank account processor. Given an initial non-negative integer balance B and a list of operations (n up to 1e 5), apply each operation in order and return the final balance. Operations are: (

  1. DEPOSIT x — add x to the balance; (
  2. WITHDRAW x — subtract x only if balance ≥ x, otherwise ignore the operation; (
  3. CASHBACK p — credit floor(balance * p /
  4. to the balance. Assume all x and p are non-negative integers; use 64-bit integers to avoid overflow. Target O(n) time and O(
  5. extra space. Provide unit tests for edge cases (zero amounts, multiple consecutive cashbacks, ignored withdrawals, large values). Example: B=100, ops=["DEPOSIT 50","WITHDRAW 120","CASHBACK 10","WITHDRAW 15"] → 18.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Coinbase•More Software Engineer•Coinbase Software Engineer•Coinbase 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.