Implement a bank account that supports deposit and withdraw operations. Withdrawals are more complex: 24 hours after a withdrawal, a cashback equal to 2% of the withdrawn amount is credited back, and the bank balance must be tracked/updated accordingly.
Asked in the online assessment stage. This was the only coding question among 12 total OA questions; the rest was non-coding and reported as difficult.
Implement bank_account(initial_balance, operations). operations contains chronological [timestamp, type, amount] records, where type is "deposit" or "withdraw". Return the balance after each operation. Apply all cashback due at or before an operation's timestamp first. Reject withdrawals exceeding the current balance. Amounts are integer cents, and withdrawal amounts are divisible by 50.
def bank_account(initial_balance, operations):