blog-cover-image

Jane Street Quant Interview Questions with Step-by-Step Solutions

In this article, we will delve into three real-world quant interview problems, providing step-by-step solutions, detailed explanations of concepts involved, and practical insights into optimal strategies.


Jane Street Quant Researcher Interview Questions - In-Depth Solutions

1. Jane Street: Two Players, 30-Sided Die Game

Problem Statement

There are two players, A and B. A 30-sided die exists with faces numbered from 1 to 30. Player A chooses a number \( a \) first, then Player B chooses a different number \( b \). The die is rolled. Whoever chose the number closer to the outcome wins an amount of money equal to the die roll. If the die lands exactly halfway between the two numbers, a predetermined tie-breaker (e.g., the lower number wins) can be assumed if necessary.
For example: If A chooses 9, B chooses 10, and the die rolls a 7, then B pays A $7.

  • Would you rather be A or B?
  • What number would you choose?
  • What is your expected return?
  • Does your strategy depend on your opponent?

Step-by-Step Solution

Understanding the Problem Structure

This is a game theory problem involving optimal choices and expectations. The key is to determine the best strategy for both players and compute the expected value for each.

Optimal Response of Player B

After Player A picks a number \( a \), Player B can choose any number \( b \neq a \). To maximize B's chance of winning, B should pick a number adjacent to \( a \), i.e., either \( a-1 \) or \( a+1 \).

  • If B picks a number further away, the range of die outcomes for which B wins becomes strictly smaller.
  • So, for any \( a \), B's best options are \( a-1 \) and \( a+1 \).

Case 1: B Chooses \( a+1 \)

Let's calculate the expected payoff to A if B picks \( a+1 \).

  • If the die rolls to a value less than or equal to \( a \), A is closer and wins.
  • If the die rolls to a value greater than \( a \), B is closer and wins.

Let \( X \) be the outcome of the die, uniformly distributed on \([1,30]\).

  • A wins if \( X \leq a \), payoff: \( X \) dollars.
  • B wins if \( X \geq a+1 \), payoff: \(-X \) dollars for A (i.e., A pays B).

Expected payoff for A:

\[ E_+(a) = \frac{1}{30} \left( \sum_{k=1}^{a} k - \sum_{k=a+1}^{30} k \right) \]

The sum of the first \( n \) integers is \( S(n) = \frac{n(n+1)}{2} \).

\[ E_+(a) = \frac{1}{30} \left( \frac{a(a+1)}{2} - \Bigg[\frac{30 \cdot 31}{2} - \frac{a(a+1)}{2}\Bigg] \right) \] \[ = \frac{1}{30} \left( \frac{a(a+1)}{2} - \frac{465 - a(a+1)}{2} \right) \] \[ = \frac{1}{30} \left( a(a+1) - 465 \right) \]

Case 2: B Chooses \( a-1 \)

Now B picks \( a-1 \).

  • A wins if \( X \geq a \), payoff: \( X \).
  • B wins if \( X \leq a-1 \), payoff: \(-X \) for A.

Expected payoff for A:

\[ E_-(a) = \frac{1}{30} \left( \sum_{k=a}^{30} k - \sum_{k=1}^{a-1} k \right) \]

Sum for \( k=a \) to \( 30 \): \( S(30) - S(a-1) \).

\[ E_-(a) = \frac{1}{30} \left( \Bigg[\frac{30 \cdot 31}{2} - \frac{(a-1)a}{2}\Bigg] - \frac{(a-1)a}{2} \right) \] \[ = \frac{1}{30} \left( 465 - (a-1)a \right) \]

Player B's Choice

Player B will choose the option that minimizes A's expected payoff, i.e., will pick whichever of \( E_+(a) \) or \( E_-(a) \) is smaller.

So, A should maximize the minimum of the two:

\[ \max_a \min \left( E_+(a), E_-(a) \right) \]

Optimal Choice for Player A

The optimal \( a \) occurs when \( E_+(a) = E_-(a) \):

\[ E_+(a) = E_-(a) \] \[ \frac{a(a+1) - 465}{30} = \frac{465 - (a-1)a}{30} \] \[ a(a+1) - 465 = 465 - (a-1)a \] \[ a(a+1) + (a-1)a = 2 \cdot 465 \] \[ [a(a+1) + (a-1)a] = a^2 + a + a^2 - a = 2a^2 \] \[ 2a^2 = 930 \] \[ a^2 = 465 \] \[ a = \sqrt{465} \approx 21.56 \]

The closest integer is \( a = 22 \).

Expected Return Calculation

Plug \( a = 22 \) into \( E_+(a) \) and \( E_-(a) \):

\[ E_+(22) = \frac{22 \times 23 - 465}{30} = \frac{506 - 465}{30} = \frac{41}{30} \approx 1.37 \] \[ E_-(22) = \frac{465 - 21 \times 22}{30} = \frac{465 - 462}{30} = \frac{3}{30} = 0.10 \]

B will choose \( a-1 = 21 \), which gives A an expected return of 0.10 per game.

Summary Table

Player Number Chosen Expected Return
A 22 0.10
B 21 -0.10

Does Strategy Depend on Opponent?

Yes. If B is not optimal (e.g., B always chooses numbers above A's choice), then A should adapt by picking even higher numbers. But against a rational opponent, the equilibrium is A picks 22, B picks 21.

Would You Rather Be A or B?

A, because with optimal play, A has a positive expected value per game.


2. Akuna Capital: Distribution of the Sum of Two Uniform Random Variables

Problem Statement

What is the distribution of the sum of two independent, uniformly distributed random variables? Formally, if \( X, Y \sim U(0,1) \), what is the distribution of \( Z = X + Y \)?

Step-by-Step Solution

Understanding the Problem

This is a classic convolution problem. The sum of two independent random variables has a probability distribution given by the convolution of their individual distributions.

Convolution of Uniform Distributions

Let \( X \) and \( Y \) be independent and both uniformly distributed on \([0,1]\). The probability density function (PDF) of \( X \) and \( Y \) is:

\[ f_X(x) = f_Y(y) = \begin{cases} 1, & 0 \leq x \leq 1 \\ 0, & \text{otherwise} \end{cases} \]

For \( Z = X + Y \), the PDF \( f_Z(z) \) is:

\[ f_Z(z) = \int_{-\infty}^{\infty} f_X(x) f_Y(z - x) dx \]

Computing the Convolution

Because both \( X \) and \( Y \) are on \( [0,1] \), \( Z \) ranges from \( 0 \) to \( 2 \).

  • For \( 0 \leq z < 1 \), \( x \) ranges from \( 0 \) to \( z \).
  • For \( 1 \leq z \leq 2 \), \( x \) ranges from \( z - 1 \) to \( 1 \).

So,

\[ f_Z(z) = \begin{cases} \int_0^z 1 \, dx = z, & 0 \leq z < 1 \\ \int_{z-1}^1 1 \, dx = 2 - z, & 1 \leq z \leq 2 \\ 0, & \text{otherwise} \end{cases} \]

Final PDF

\[ f_Z(z) = \begin{cases} z, & 0 \leq z < 1 \\ 2 - z, & 1 \leq z \leq 2 \\ 0, & \text{otherwise} \end{cases} \]

Graphical Representation

The distribution is triangular, peaking at \( z = 1 \).

  • For \( 0 \leq z < 1 \), density increases linearly from 0 to 1.
  • For \( 1 \leq z \leq 2 \), density decreases linearly from 1 to 0.

Properties

  • Mean: \( E[Z] = 1 \)
  • Variance: \( \text{Var}(Z) = \frac{1}{6} \)

Generalization

If \( X \sim U(a, b) \), \( Y \sim U(c, d) \), then \( Z \) has a trapezoidal/triangular distribution with appropriate scaling and shifts.


3. Citadel: Array Transformation with Consecutive Duplicates

Problem Statement

Given an array of numbers: [1,5,3,2,4,2,3,1,2,3,2,4], return another array with duplicate numbers in consecutive positions and in order of their first appearance. For the example, the result should be: [1,1,5,3,3,3,2,2,2,2,4,4].

Step-by-Step Solution

Understanding the Problem

This is a data structure and algorithm problem. The aim is to:

  • Group all instances of the same value together, in order of their first appearance in the original array.
  • All occurrences of each number must be consecutive in the output.

Algorithm Outline

  1. Iterate through the input array, keeping track of numbers already seen (to maintain the first appearance order).
  2. For each new number, collect all occurrences in order.
  3. Concatenate the grouped occurrences in the order they first appeared.

Python Implementation


def group_duplicates(arr):
    from collections import OrderedDict
    result = []
    counter = OrderedDict()
    for num in arr:
        if num in counter:
            counter[num].append(num)
        else:
            counter[num] = [num]
    for group in counter.values():
        result.extend(group)
    return result

arr = [1,5,3,2,4,2,3,1,2,3,2,4]
print(group_duplicates(arr))
# Output: [1, 1, 5, 3, 3, 3, 2, 2, 2, 2, 4, 4]

Step-by-Step Example

Let’s walk through the example array:


arr = [1,5,3,2,4,2,3,1,2,3,2,4]
# Step 1: Encounter 1 → {1: [1]}
# Step 2: Encounter 5 → {1: [1], 5: [5]}
# Step 3: Encounter 3 → {1: [1], 5: [5], 3: [3]}
# Step 4: Encounter 2 → {1: [1], 5: [5], 3: [3], 2: [2]}
# Step 5: Encounter 4 → {1: [1], 5: [5], 3: [3], 2: [2], 4: [4]}
# Step 6: Encounter 2 → {1: [1], 5: [5], 3: [3], 2: [2,2], 4: [4]}
# Step 7: Encounter 3 → {1: [1], 5: [5], 3: [3,3], 2: [2,2], 4: [4]}
# Continue until end...
# Final: {1: [1,1], 5: [5], 3: [3,3,3], 2: [2,2,2,2], 4: [4,4]}

Concatenating all lists in order gives [1,1,5,3,3,3,2,2,2,2,4,4].

Generalization

This algorithm works for any list of hashable elements, not just integers. It efficiently groups all duplicates together in the order of their initial occurrence.


Conceptual Takeaways and Interview Insights

Game Theory and Optimal Strategies

The Jane Street die game exemplifies the importance of anticipating an opponent’s best response in sequential games. Notably:

Probability Distributions and Convolution

The sum of two independent uniform random variables is a classic example of how convolutions work in probability. The triangular distribution result is widely applicable, especially in finance, risk management, and simulation, where sums of random variables are often encountered.

Data Structures, Order Preservation, and Efficient Grouping

The Citadel array problem is a practical test of your ability to manipulate data structures efficiently:


Frequently Asked Quant Interview Questions: Additional Examples

To further prepare, here are some related questions often encountered in top quant interviews:


Conclusion

Quantitative interviews at firms like Jane Street, Akuna Capital, and Citadel test not just mathematical and programming skills, but also strategic thinking and the ability to generalize solutions. The key to success is a deep understanding of probability, game theory, algorithms, and efficient data manipulation—core concepts that underlie real-world quantitative research and trading.

By practicing and mastering these types of problems, you’ll be well-prepared to tackle the challenging and rewarding world of quantitative finance interviews.

  • OrderedDict ensures insertion order is preserved (first appearance).
    • For each element in the input array, we append it to a list keyed by that number in the OrderedDict.
    • Finally, we concatenate all the lists in the order of their first appearance to form the result.
    • Time Complexity: O(n), since each element is visited and processed exactly once.
    • Space Complexity: O(n), due to storage in the intermediate dictionary and the output array.
    • Identify possible choices and restrict analysis to only those that rationally maximize or minimize payoff (e.g., B should only pick adjacent numbers).
    • Use mathematical analysis (solving for equilibrium points) to find optimal strategies.
    • Always consider whether your strategy should adapt to an opponent’s irrational choices.
    • Remember: the sum of two uniform random variables over [0,1] yields a triangular distribution.
    • This concept extends to convolutions of other distributions and underpins the Central Limit Theorem for large numbers of summed variables.
    • Correctly grouping elements while preserving order is a common requirement in data cleaning, aggregation, and reporting.
    • Ordered dictionaries or hash maps are key tools in maintaining insertion order while grouping elements.
    • You should be able to reason about and implement such transformations efficiently in any programming language.
    • Probability puzzles: For example, “You roll two dice. What is the probability that the sum is at least 9?”
    • Expectation calculations: “What is the expected number of coin tosses until you see two heads in a row?”
    • Dynamic programming and optimization: “Given a sequence of trades, how do you maximize profit with at most K transactions?”
    • Statistical estimation: “How would you estimate the volatility of a financial asset from historical price data?”

Related Articles