NewThe Learning module is now liveSee what's new

Design a simple banking system that supports creating customer accounts, depositing money, and transferring funds between accounts. Each operation is timestamped with increasing integer times to simulate a real-time system.

Implement the BankingSystem class:

  • BankingSystem() Initializes the banking system with no accounts.

  • boolean createAccount(int timestamp, String accountId) Creates a new account identified by accountId with a zero balance.

    • Returns true if the account is created successfully.
    • Returns false if an account with the same accountId already exists.
  • int deposit(int timestamp, String accountId, int amount) Adds amount to the balance of the existing account accountId.

    • Returns the new balance if the account exists.
    • Returns -1 if accountId does not exist.
Test Cases
Input
Output
Expected