← Agoda Interview Insights

Agoda·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Agoda data/quant interview with a probability puzzle that had a coding component attached. The math part was manageable but having to also write a Monte Carlo sim on the spot added some pressure I wasn't fully expecting.

Questions Asked (3)

Q1

You have two dice: one with faces 1 through 5, another with faces 1 through 6. You roll both repeatedly and stop the moment either die lands on 1. What is the probability that the 5-sided die is the one that shows 1 first?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The key is figuring out what 'first' means when both could show 1 on the same roll.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the process as a race between two independent geometric distributions, where each die has a constant probability of showing 1 on each roll. Compute the probability that the 5-sided die wins by summing over the number of rolls until the first 1 appears, or by using the formula for the probability that one geometric random variable is less than another. Alternatively, condition on the outcome of the first roll to set up a recursive equation.

Pro tip: After deriving the answer, verify it with a quick simulation or by checking edge cases (e.g., if both dice had the same number of sides, the probability should be 1/2). This demonstrates rigor and guards against off-by-one errors.

1. Define the random variables and stopping condition

Let X be the number of rolls until the 5-sided die shows 1, and Y be the number of rolls until the 6-sided die shows 1. The process stops at the first 1, so we want P(X < Y) (since ties are impossible).

2. Identify the distributions

X and Y are independent geometric random variables with success probabilities p = 1/5 and q = 1/6, respectively. Their probability mass functions are P(X = k) = (4/5)^{k-1} (1/5) and P(Y = k) = (5/6)^{k-1} (1/6).

3. Compute the probability of interest

Calculate P(X < Y) by summing over all possible values of X: P(X < Y) = sum_{k=1}^∞ P(X = k) P(Y > k). Alternatively, use the formula for the probability that one geometric is less than another: P(X < Y) = p(1-q) / (p + q - pq).

4. Perform the calculation

Plug in p = 1/5 and q = 1/6 into the formula: numerator = (1/5)*(5/6) = 1/6; denominator = 1/5 + 1/6 - (1/5)*(1/6) = 1/5 + 1/6 - 1/30 = 6/30 + 5/30 - 1/30 = 10/30 = 1/3. Thus P(X < Y) = (1/6) / (1/3) = 1/2.

5. Interpret and verify

The probability is 1/2, meaning the 5-sided die is equally likely to show 1 first as the 6-sided die. Verify by simulation or by checking that the sum of probabilities (including the 6-sided die winning) equals 1.

Key Points to Mention

  • Independence of the two dice rolls
  • Geometric distribution and its memoryless property
  • The formula for P(X < Y) when X and Y are independent geometric random variables
  • The symmetry argument: despite different success probabilities, the race is fair because the 5-sided die has a higher chance per roll but the 6-sided die has more faces (lower chance per roll)
  • Alternative solution via recursion: condition on the first roll and set up an equation
  • Verification by simulation or by computing P(Y < X) and checking that P(X < Y) + P(Y < X) = 1

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

For the same two-dice setup, what is the expected number of rolls until the game stops?

Algorithms & Data Structures
Author's notes

Once you know the stopping probability per roll it's just a geometric expectation.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the stopping condition for the two-dice game (e.g., stop when a certain sum appears). Then, model the process as a Markov chain with states representing the relevant game history, and solve for the expected number of rolls using first-step analysis or by setting up linear equations for the expected hitting time.

Pro tip: Always state your assumptions about the stopping rule explicitly—interviewers often leave it ambiguous to test if you ask clarifying questions. Also, mention that you can verify your answer via simulation, which shows practical data science maturity.

1. Clarify the stopping condition

Ask the interviewer to specify exactly when the game stops (e.g., when a particular sum is rolled, or when a specific pattern occurs). This ensures you solve the correct problem.

2. Define states and transitions

Identify the minimal state space needed to capture the game's progress (e.g., the last roll, or whether a target sum has appeared). List all possible transitions and their probabilities.

3. Set up equations for expected rolls

Let E_i be the expected additional rolls from state i. Use first-step analysis: E_i = 1 + sum_j P(i -> j) * E_j, with E_terminal = 0.

4. Solve the system

Solve the linear equations for the initial state to get the expected number of rolls. If the state space is small, solve by substitution; otherwise, use matrix algebra.

5. Verify and interpret

Check the result for reasonableness (e.g., compare to a simulation or known bounds). Explain the answer in the context of the game.

Key Points to Mention

  • Markov chain modeling and first-step analysis
  • State space definition and transition probabilities
  • Linearity of expectation and solving linear equations
  • Handling of absorbing states (game stops)
  • Verification via simulation or alternative methods
  • Clarifying ambiguous stopping conditions before solving

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Write a Monte Carlo simulation to verify your answers to the dice probability problem.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where I slowed down.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clearly restating the dice probability problem and the analytical answer you derived. Then outline a Monte Carlo simulation design: define the random experiment, run a large number of trials, compute the empirical probability, and compare it to the analytical result with appropriate error metrics. Finally, discuss how you would validate the simulation and interpret any discrepancies.

Pro tip: Mention the importance of using a fixed random seed for reproducibility and reporting a confidence interval for the Monte Carlo estimate to quantify uncertainty. This shows rigor and awareness of best practices in simulation.

1. Clarify the problem and expected outcome

Restate the dice probability problem and the analytical answer you previously computed. Confirm what event or probability the simulation should verify.

2. Design the simulation

Define the random experiment (e.g., rolling dice, summing outcomes), the number of trials, and how you will record successes. Choose a suitable random number generator and set a seed for reproducibility.

3. Implement and run the simulation

Write code to perform the trials efficiently (vectorized operations if possible). Run the simulation with a large number of trials to reduce variance.

4. Analyze results and compare

Compute the empirical probability and compare it to the analytical answer. Calculate the standard error or confidence interval to assess the precision of the estimate.

5. Validate and discuss

Check for convergence by running multiple simulations or increasing trials. Discuss any discrepancies, potential sources of error, and the limitations of Monte Carlo methods.

Key Points to Mention

  • Law of Large Numbers: as the number of trials increases, the empirical probability converges to the true probability.
  • Choice of number of trials: balance between accuracy and computational cost; typically 10,000 to 1,000,000 trials.
  • Random seed for reproducibility and debugging.
  • Confidence intervals or standard error to quantify uncertainty in the estimate.
  • Vectorization for efficiency in languages like Python (NumPy) or R.
  • Comparison with analytical result and interpretation of any deviation.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.