Optiver OA records – Optiver – 一亩三分地 – OA 代写 – OA 代做 – OA writing

Optiver 的OA 花费接近3个小时,其中最难的一部分是2道算法题,限时120分钟,我们一起来看看吧

Question 1

Suppose you are responsible for building a log server that will receive a large number of logs. Each log will have a log ID and timestamp. We want to keep track of these logs, but due to storage limitations, we can only return up to m logs from the last hour when requested.

Problem Statement

Complete the following functions:

  • recordLog(logId, timestamp): Records a new log entry.
    • Each log is represented as an object with a logId and timestamp. The logId is an identifier for each log and the timestamp is an integer in seconds representing when the log was sent.
    • Logs may be received out of order.
    • The log ID is not guaranteed to be unique - the same log ID can be used for different logs.
  • getLogs(): Returns a comma-separated string of the latest m logs from the last hour ascending by timestamp. In the event of a timestamp tie, order from earliest received to latest.
    • Return a string of the form "logId1,logId2,logId3,logId4" where logId4 is the latest timestamp log and logId1 is the earliest timestamp log received < 1 hour before logId4's timestamp.
  • getLogCount(): Returns the total number of logs received < 1 hour from the most recently stored log timestamp. In the event more than m logs have been received still return the full count of logs.

Constraints

  • 1 ≤ m ≤ 1000
  • 1 ≤ logId ≤ 10^6
  • 1 ≤ timestamp ≤ 10^9
  • Multiple calls to recordLog and getLogs may be made.

Question 2

As a lion trainer, you are taking part in an international lion exhibition. During the event, lions from different teams enter and exit the showroom where lion experts inspect and score them.

Lions do not enter the showroom all at once, as that would cause too much commotion. The organizers of the event let them in and out based on a predefined schedule. Before the show, you are given the schedule for your lions, but not for the others. During the show, however, you can observe all lions entering and exiting the room.

Based on your experience, you believe that judges tend to award the largest lions with the highest scores. Before the final results are out, you want to estimate your chances of winning this competition.


Problem Statement

Complete the following:

  • The LionCompetition class constructor that accepts lion descriptions and the private schedule for your lions.
  • The lionEntered and lionLeft methods that are called whenever a new lion enters or leaves the room.
  • The getBiggestLions method that, for the current time, returns a list of your lions in the room that are at least as large as the largest lion from competing teams in the room, sorted alphabetically.

Function Definitions

  1. LionCompetition class constructor parameters:
    • lions: List of elements describing your lions:
      • name: String representing the name of the lion.
      • height: Height of the lion.
    • schedule: A private schedule of when your lions enter and leave the showroom:
      • name: String representing the name of the lion.
      • enterTime: Number of minutes since the start of the show when the lion will enter the room.
      • exitTime: Number of minutes since the start of the show when the lion will exit the room.
  2. Constraints:
    • Subsequent invocations of lionLeft and lionEntered methods are always called in order, according to the currentTime parameter.
    • The schedule is strictly followed - your lions enter and exit the room exactly at their specified times.
    • The lion inspection (invocation of the getBiggestLions method) takes place either before or after all lions scheduled to enter or leave the room at a given minute did that - never in between.
    • Lion names are unique.
    • Times (currentTime, enterTime, and exitTime) are always whole numbers (and multiple events can occur at the same time).
    • A single lion enters the room only once during the show.

Input Format for Custom Testing

Sample Case 0:

Sample Input for Custom Testing:

definition marry 300
definition rob 250
schedule marry 10 15
schedule rob 13 20
start
8 enter 200
10 enter 310
10 enter 300
11 inspect
13 enter 250
15 inspect
20 leave 310
20 leave 300
20 leave 250

后面的part2就是选择题,part3是一些考验反应速度和智力的网页游戏,均比较容易。

我们长期稳定承接各大科技公司如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 *