← 返回 stripe 的题目列表Account Balance Calculation and Transaction Management
类型:online_judge
Given a triple string in the format account_id, timestamp, currency, money, the first task is to return the final balance of each account, excluding those with a balance of 0. The task is to sum the money for each account. The second task ensures that currency never goes below 0, thus a transaction that causes a negative balance should be rejected. Additionally, enable a debiting platform for when an account has an insufficient balance. If an account is short on money, it should take money from the connected account (platform account), and if that account is empty, the transaction should be rejected. The platform account id should be passed as a parameter.
Example
Input
[(‘acc1’, ‘2022-01-01’, ‘USD’, 100), (‘acc1’, ‘2022-01-02’, ‘USD’, -50)]