[Anthropic] CodeSignal OA Pre-Screen 2025 – 24 Apr (generic)

Level 1

Account Creation

create_account(self, timestamp: int, account_id: str) -> bool

Creates a new account with the given identifier if it doesn’t already exist.
Returns True if the account was successfully created or False if an account with that id already exists.

Deposit

deposit(self, timestamp: int, account_id: str, amount: int) -> int | None

Deposits the given amount of money to the specified account.
Returns the balance of the account after the operation or None if the account doesn’t exist.

Transfer

transfer(self, timestamp: int, source_account_id: str, target_account_id: str, amount: int) -> int | None

Transfers the given amount of money from source_account_id to target_account_id.
Returns the balance of source_account_id if successful, or None if:

  • source_account_id or target_account_id doesn’t exist
  • source_account_id and target_account_id are the same
  • source_account_id has insufficient funds

Level 2

Top Spenders

top_spenders(self, timestamp: int, n: int) -> list[str]

Returns the identifiers of the top n accounts with the highest outgoing transactions — including money transferred or withdrawn.
Returns list in the format:

["account_id_1>(total_outgoing_1)", "account_id_2>(total_outgoing_2)", ..., "account_id_n>(total_outgoing_n)"]

Accounts are sorted by:

  1. Descending order of total outgoing amount
  2. Alphabetical order of account_id in case of a tie

If fewer than n accounts exist, returns all.

Cashback is not counted in outgoing totals.

Level 3

Pay

pay(self, timestamp: int, account_id: str, amount: int) -> str | None

Withdraws the specified amount from the account and provides a 2% cashback (rounded down). Cashback is refunded 24 hours later (86400000 milliseconds).
Returns:

  • Unique payment identifier (e.g., "payment1", "payment2") on success
  • None if:
    • Account doesn’t exist
    • Insufficient funds
    • Refund fails due to account being removed

top_spenders now includes withdrawals in the total outgoing calculation.

Get Payment Status

get_payment_status(self, timestamp: int, account_id: str, payment: str) -> str | None

Returns the status of the payment:

  • "IN_PROGRESS" if cashback is pending
  • "CASHBACK_RECEIVED" if cashback has been processed

Returns None if:

  • Account doesn’t exist
  • Payment doesn’t exist
  • Payment was made from a different account

Level 4

Merge Accounts

merge_accounts(self, timestamp: int, account_id_1: str, account_id_2: str) -> bool

Merges account_id_2 into account_id_1. Returns True if successful, False if:

  • Both account IDs are the same
  • One or both accounts do not exist

Behavior after merge:

  • Pending cashback refunds for account_id_2 go to account_id_1
  • Payment status queries for account_id_2 are redirected using account_id_1
  • Balances are combined
  • account_id_2 is removed
  • top_spenders reflects combined outgoing amounts

Get Balance at Time

get_balance(self, timestamp: int, account_id: str, time_at: int) -> int | None

Returns the balance of account_id at time_at.

  • Returns None if the account didn’t exist at time_at
  • Returns balance after queries processed at time_at
  • Merged accounts inherit balance history

我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.

Leave a Reply

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