CS-OA cs-vo Faang

Bank OA – OOD OA – 面向对象coding test – interview proxy – OA 代写 – codesignal

近期某北美金融机构发放OA中,今天我们一起来分享查看其中一道OOD的题目。 与传统的算法题目不同,OOD的笔试在现在的OA中算比较罕见的部分。

Instructions

Your task is to implement a simplified version of a banking system. All operations that should be supported are listed below. Solving this task consists of several levels. Subsequent levels are opened when the current level is correctly solved. You always have access to the data for the current and all previous levels.

Requirements

Plan your design according to the level specifications below:

  • Level 1: The banking system should support creating new accounts, depositing money into accounts, and transferring money between two accounts.
  • Level 2: The banking system should support ranking accounts based on outgoing transactions.
  • Level 3: The banking system should allow scheduling payments with cashback 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.

To move to the next level, you should pass all the tests at this level.

Problem Description

You will implement a simple banking system that supports the following operations:

  1. Creating an account
  2. Depositing money
  3. Transferring money between two accounts

Each operation is associated with a unique, strictly increasing timestamp.

Operations Details

  • CREATE_ACCOUNT <timestamp> <accountId>
    • Creates a new account with the specified identifier if it doesn't already exist.
    • Returns "true" if the account was successfully created, "false" if an account with the specified accountId already exists.
  • DEPOSIT <timestamp> <accountId> <amount>
    • Deposits the specified amount of money into the given account.
    • The operation should succeed only if the account exists; otherwise, it returns an empty string.
  • TRANSFER <timestamp> <sourceAccountId> <destinationAccountId> <amount>
    • Transfers the specified amount from the source account to the destination account.
    • The operation should return the new balances of both accounts separated by a comma, e.g., "sourceBalance,destinationBalance".
    • If either account does not exist or the source account does not have sufficient funds, it returns an empty string.

Input

  • An array of strings representing queries, where each query calls one of the operations. The parameters are in the correct format, and the operations are ordered by increasing timestamps.

Output

  • An array of strings representing the results of each operation.

Constraints

  • 1 ≤ number of queries ≤ 5000

Example

Given the following queries:

[    ["CREATE_ACCOUNT", "1", "account1"],
["CREATE_ACCOUNT", "2", "account1"],
["CREATE_ACCOUNT", "3", "account2"],
["DEPOSIT", "4", "non-existing", "2700"],
["DEPOSIT", "5", "account1", "2700"],
["TRANSFER", "6", "account1", "account2", "2701"],
["TRANSFER", "7", "account1", "account2", "200"]
]

The expected output would be:

["true", "false", "true", "", "2700", "", "2500"]

Explanation:

  • Two attempts to create "account1" result in one success and one failure.
  • Deposit to a non-existing account fails.
  • Successful deposit followed by a failed transfer (insufficient funds) and a successful transfer.

当然最后我们轻松通过了level 4 , 对于我们来说,这种题目可能需要花费比算法题更多的时间,因为理解题意,调试代码都是比较麻烦的过程。

如果您也有OA代写的需求,请联系我们,我们服务至上,励志做北美面试支持机构第一品牌。 CSOAHELP

Leave a Reply

Your email address will not be published. Required fields are marked *