InterviewDB Experience

Banking System Simulation - Industry Coding Framework Interview

Interview Experience

Problem

Implement a multi-level banking system. Operations are applied in order.

Level 1: Basic accounts.

CREATE_ACCOUNT id             -> "created" or "error" if exists
DEPOSIT id amount             -> new balance or "error" if no account
WITHDRAW id amount            -> new balance or "error" if insufficient funds
GET_BALANCE id                -> balance or "error"

Level 2: Transfers and fees.

TRANSFER from to amount       -> "success" or "error"
# Fee: 1% of transfer amount deducted from sender (in addition to amount)

Level 3: Transaction history.

HISTORY id n                  -> last n transactions as list of strings

Level 4: Scheduled transfers.

SCHEDULE from to amount time  -> execute TRANSFER at given time tick
TICK                          -> advance clock by 1, execute due scheduled transfers

Follow-ups
- How do you represent the transaction log efficiently for O(1) append and O(k) recent-k queries?
- What happens to a scheduled transfer if the sender has insufficient funds at execution time?
- How would you add interest accrual: 2% monthly applied at each TICK that crosses a month boundary?

Full Details

Problem

Implement a multi-level banking system. Operations are applied in order.

Level 1: Basic accounts.

CREATE_ACCOUNT id             -> "created" or "error" if exists
DEPOSIT id amount             -> new balance or "error" if no account
WITHDRAW id amount            -> new balance or "error" if insufficient funds
GET_BALANCE id                -> balance or "error"

Level 2: Transfers and fees.

TRANSFER from to amount       -> "success" or "error"
# Fee: 1% of transfer amount deducted from sender (in addition to amount)

Level 3: Transaction history.

HISTORY id n                  -> last n transactions as list of strings

Level 4: Scheduled transfers.

SCHEDULE from to amount time  -> execute TRANSFER at given time tick
TICK                          -> advance clock by 1, execute due scheduled transfers

Follow-ups
- How do you represent the transaction log efficiently for O(1) append and O(k) recent-k queries?
- What happens to a scheduled transfer if the sender has insufficient funds at execution time?
- How would you add interest accrual: 2% monthly applied at each TICK that crosses a month boundary?

About This Question

This is a candidate experience report from a codesignal interview.

It covers the following topics: Coding, Strings, Industry Coding Framework .