CONTENTS

    My Firsthand Experience Solving Optiver HackerRank Questions

    avatar
    Seraphina
    ·October 15, 2025
    ·5 min read
    I am sharing my real experience with Optiver Hackerrank questions in 2025 and the secrets that helped me succeed

    Optiver HackerRank Questions

    The Optiver online assessment consists of four parts: NumberLogic, Beat The Odds, Zap-N, and a coding section. I’ll share the details of the coding part, it’s completed on HackerRank and includes three questions with a total time limit of 90 minutes.

    I am really grateful for the tool Linkjob.ai, and that's also why I'm sharing my entire interview experience here. Having an invisible AI assistant during the interview is indeed very convenient.

    Question 1

    Goal: Calculate the number of distinct sequences to reach the target number of shares n from the initial number of shares k through at most m buy or sell transactions (1 share each time).

    Core conditions:

    • The total number of buy transactions is (n - k) more than the total number of sell transactions (net purchase quantity)

    • The total number of operations (buys + sells) does not exceed m

    • The number of shares held cannot be negative at any time

    Solve using dynamic programming:

    • Define dp[i][j] as the number of sequences with i operations and j shares held

    • Initial state: dp[0][k] = 1 (only the initial state when there are no operations)

    • State transition:

      • For each operation, you can buy: dp[i + 1][j + 1] += dp[i][j]

      • Or sell (if j > 0): dp[i + 1][j - 1] += dp[i][j]

    • Result: Sum of dp[i][n] for all i (0 ≤ i ≤ m)

    Question 2

    Goal: Allocate funds according to fixed weights, rebalance daily, and calculate the mean and standard deviation of daily log returns.

    Operation steps:

    • Initially buy stocks according to weights (capital × weight ÷ stock price = number of shares held)

    • Calculate the current total assets daily (sum of the number of shares held for each stock × the stock price of the day)

    • Rebalance: Adjust the number of shares held according to the stock prices and weights of the day (to ensure the proportion of each stock remains unchanged)

    • Calculate daily return: ln(current day's assets ÷ previous day's assets)

    Statistical calculation:

    • The average of all daily returns

    • The standard deviation of all daily returns

    Question 3

    Goal: Simulate order book trading and calculate the total sum of all transaction prices.

    Order book maintenance:

    • Buy order list: Sorted in descending order of price (to easily find the highest feasible price)

    • Sell order list: Sorted in ascending order of price (to easily find the lowest feasible price)

    Order processing logic:

    • When processing a buy order: Find the lowest sell order with a price ≤ the buy order price. After the transaction, remove the sell order and accumulate the transaction price

    • When processing a sell order: Find the highest buy order with a price ≥ the sell order price. After the transaction, remove the buy order and accumulate the transaction price

    • Orders that cannot be transacted are added to the corresponding list for waiting

    Result: The total sum of all transaction prices

    Optiver Hackerrank Questions Overview

    From my experience with Optiver's Hackerrank assessment, the questions primarily focus on two key areas: Coding and Problem-Solving, and Quantitative and Probability. These align closely with the skills needed for roles that blend technical execution with financial reasoning, as reflected in the three questions we’ve discussed.

    Coding and Problem-Solving

    This section tests my ability to translate real-world trading scenarios into structured code, emphasizing logic, efficiency, and adherence to constraints.

    Dynamic Programming for Sequential Decisions: The first question required me to model state transitions with dynamic programming. This tested my ability to break complex sequential problems into manageable subproblems.

    Order Book Simulation with Structured Data: The third question, simulating order book transactions, focused on efficient data structure usage. Processing each order involved checking for feasible matches, updating totals, and managing unexecuted orders; these skills are critical for real-time trading systems.

    Iterative Process Modeling: Both the portfolio rebalancing question (second question) and the sequence-counting problem required step-by-step simulation. For rebalancing, this meant daily recalculations of asset values, adjusting holdings to maintain weights, and tracking returns.

    Quantitative and Probability

    These questions assess my ability to apply mathematical reasoning to financial contexts, directly tied to trading and portfolio management.

    Return Calculations and Rebalancing Logic: The second question centered on computing daily log returns for a portfolio with fixed weights. I applied logarithmic transformations to daily asset values to calculate returns, while ensuring rebalancing preserved weight proportions.

    Statistical Aggregation: After computing daily returns, I derived mean and standard deviation, key metrics for assessing risk and return profiles in trading.

    Constraint-Based Counting: The first question also involved probabilistic thinking, as it required counting valid transaction sequences under constraints. This mirrors real-world scenarios where traders evaluate possible paths to achieve position goals.

    Preparation for Optiver Hackerrank Questions

    Programming Skills

    I started prepping by brushing up on programming basics, focusing on Python. It’s fast and easy to code with during timed tests. I practiced writing clean code quickly, and also worked on reading code. Using online platforms, I tackled various question types, making sure data structures like arrays, lists, and dictionaries felt intuitive.

    Math and Logic Practice

    A solid math foundation was just as critical. So I dedicated time to brushing up on math topics key for quantitative finance roles, including:

    • Stochastic calculus

    • Partial differential equations (PDEs)

    • Advanced numerical methods

    I also practiced high-speed arithmetic, probability puzzles, and expected-value problems. To align with the test’s style, I hunted for Optiver-specific practice tests and materials online.

    Mock Tests

    Mock tests played a huge role in my preparation. I set up mock sessions for timed coding and SQL tests. I also scheduled mock interviews to get feedback on my technical and behavioral skills.

    I tried out full-length practice tests, like the personalized mock interviews offered by Linkjob.ai, where the questions are drawn from real interview experiences. These helped me spot my weak areas and improve my speed.

    FAQ

    What are the other parts of Optiver’s online assessment like?

    NumberLogic gives you 25 minutes to solve one question.

    Beat The Odds lasts 30 minutes in total, but you only have 90 seconds for each question.

    Zap-N is presented in the form of a mini game, with a total duration of 60 minutes.

    Can I take breaks between the four OA sections? Do I have to finish them all in one go?

    You can take breaks in between, as long as you complete everything within the given time frame. The OA must be finished within seven days.

    If I don’t pass the interview, can I reapply later?

    Yes, you can, but Optiver only allows one application within a 12-month period.