optiver oa | optiver oa questions | optiver oa 2025

1,471 Views
optiver oa | optiver oa questions | optiver oa 2025

Optiver OA Question 1

Problem Statement

Complete the following functions.

  • recordLog(logId, timestamp): Records a new log entry.
    • Each log has a logId and a Timestamp (in seconds).
    • Ignore logs with timestamps earlier than the latest recorded log.
    • The same logId may appear multiple times.

getLogs(): Returns a comma-separated string of the latest m logIds from the last hour, in the order received.

  • Format. "logId1,logId2,...", where the last ID is the most recent.

getLogCount(): Returns the total number of logs received in the last hour from the most recent log's timestamp (even if > ).

Input Format

The first line: integer m (max logs for getLogs()).

The second line: integer q (# of queries), followed by q lines.

  • RECORD logId timestamp
  • GET_LOGS
  • COUNT

Constraints

  • 1 ≤ m ≤ 1000
  • 1 ≤ q ≤ 10⁶
  • logId, Timestamp are integers

Output Format

For each GET_LOGS And COUNT query, print the result on its own line.

Sample Input

100
10
RECORD 1 0
RECORD 2 300
GET_LOGS
COUNT
RECORD 3 1200
RECORD 1 1800
GET_LOGS
GET_LOGS
RECORD 4 3900
GET_LOGS

Sample Output

1,2
2
1,2,3,1
4
3,1,4

Optiver OA Question 2: Future Pricing

Problem Statement

Compute future stock prices given dividends. if today's price is S, and a dividend A is paid at day D:

  • For days 0 to D-1: price = S.
  • From day D onwards: price = S-A.
  • Multiple dividends subtract cumulatively.

Example

S = 1000, dividends: (1) A₁=100 at day 10, (2) A₂=50 at day 100
Prices.

  • Day 0-9: 1000
  • Day 10-99: 900
  • Day 100+: 850

Constraints

  • 1 ≤ number of dividends ≤ 1000
  • 1 ≤ q ≤ 10⁶
  • All amounts and days are integers

Reference

Optiver OA | Acreage
Optiver Online Assessment

If you need interview or OA support services, please contact us .

author avatar
Jack Xu MLE | Microsoft Artificial Engineer
Ph.D. From Princeton University. He lives overseas and has worked in many major companies such as Google and Apple. The deep learning NLP direction has multiple SCI papers, and the machine learning direction has a Github Thousand Star⭐️ project.
END