← Upstart Interview Insights

Upstart·Software Engineer·Technical Phone Screen·Senior

Senior
Apr 2026

Summary

Coding round for a Research Scientist role at Upstart. One question, pretty focused on simulation and probability, the kind of thing where you need to actually write working code and also know the math behind it.

Questions Asked (1)

Q1

Write a simulation of a particle decay process: start with 100 particles, each day every surviving particle independently decays with probability 1/2, run for 10 days across many trials (around 100,000), and estimate the probability that at least one particle survives. Then compare your Monte Carlo result to the exact analytical answer.

Algorithms & Data StructuresA/B Testing & Experimentation
Author's notes

The coding part was fine, nested loops, count survivors, average across trials.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, derive the exact probability analytically: each particle survives 10 days with probability (1/2)^10 = 1/1024, so the probability at least one of 100 particles survives is 1 - (1 - 1/1024)^100. Then implement a Monte Carlo simulation with 100,000 trials, each simulating 10 days for 100 particles, and compare the estimated probability to the exact value, discussing statistical error and convergence.

Pro tip: Mention that the exact answer can be computed efficiently using logarithms to avoid numerical underflow, and that the Monte Carlo standard error can be estimated as sqrt(p*(1-p)/N) to quantify uncertainty.

1. Analytical derivation

Compute the exact probability that at least one particle survives after 10 days. Each particle independently survives with probability (1/2)^10 = 1/1024, so the probability that none survive is (1 - 1/1024)^100, and the desired probability is 1 minus that.

2. Simulation design

Plan the Monte Carlo simulation: for each of 100,000 trials, simulate 100 particles over 10 days. For each particle, at each day, draw a uniform random number and decay if it is less than 0.5. Track whether at least one particle survives the full 10 days.

3. Implementation and efficiency

Implement the simulation in code, using vectorized operations or early termination when all particles have decayed to speed up execution. Ensure the random number generator is seeded for reproducibility.

4. Result comparison and error analysis

Compute the estimated probability from the simulation and compare it to the exact analytical value. Calculate the standard error of the estimate and discuss whether the difference is within expected statistical fluctuations.

5. Discussion of convergence and extensions

Comment on how the estimate converges as the number of trials increases, and mention potential extensions such as varying the decay probability or number of particles to test the simulation's robustness.

Key Points to Mention

  • Exact probability formula: 1 - (1 - (1/2)^10)^100
  • Monte Carlo simulation with 100,000 independent trials
  • Use of random number generation and thresholding for decay events
  • Standard error of the Monte Carlo estimate: sqrt(p*(1-p)/N)
  • Comparison of simulated and analytical results, checking for statistical significance
  • Efficiency considerations: vectorization, early termination, and reproducibility via seeding

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