LeetCode Question · May 2024 · San Francisco

Dropbox | Online Assessment | Banking Syste,

2 upvotes 290 views 4 replies

Question Details

Build a python class for a banking system Level 1: Support creating new accounts, depositing money into accounts, and transferring money between two accounts. Level 2: Ranking accounts (i.e top_spenders) based on...

Full Details

Build a python class for a banking system
Level 1: Support creating new accounts, depositing money into accounts, and transferring money between two accounts.
Level 2: Ranking accounts (i.e top_spenders) based on outgoing transactions.
Level 3: The banking system should allow scheduling payments with cashback (2% cashback deposited to account 24 hours after transaction) and checking the status of scheduled payments .
Level 4: The banking system should support merging two accounts while retaining both accounts\' balance and transaction histories.

It\'s important to read the whole question, since in Level 4 it says "retain transaction histories" while you can get away with doing all Level 1 and 2 and 3 without building any construct of a transaction history.

That\'s where they got me.

Signatures of functions are

python
create_account(timestamp : int, account : str) -> str
deposit(timestamp : int, account : str, amount : int) -> str
transfer(timestamp : int, account1 : str, account2 : str amount : int) -> str
top_spenders(timestamp : int, n : int) -> str
pay(timestamp : int, account : str, amount : int) -> str (returns payment_id)
check_payment_status(timestamp : int, account : str, payment_id : str) ->

**returns** "IN_PROGRESS", "CASHBACK_COMPLETED"
merge_account(timestamp : int, account1 : str, account2 : str) -> str
get_balance(timestamp : int, account : str, time_at : str) -> str
\t\tthis should support an account that might\'ve been merged

For Level 1 and Level 2 timestamp is not even necessary, but it becomes important for level 3 and level 4

About This Question

This is a reported interview question from a dropbox interview for a swe role (junior level) during the oa round reported in 2024.

It covers the following topics: General Experience .