← IMC Interview Insights

IMC·Machine Learning Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

IMC machine learning engineer interview that leaned pretty hard into probability fundamentals. Both questions came straight out of the Green Book, which I'd skimmed but not drilled nearly enough.

Questions Asked (2)

Q1

Gambler's Ruin: a player starts with $i dollars and bets $1 per round on a fair coin flip, stopping when they either hit $N or go broke. What's the probability of going bankrupt, as a function of i and N? Then extend the result to a biased coin where the win probability is p ≠ 0.5.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I knew the fair-coin answer off the top of my head (probability of ruin is (N-i)/N) but the biased extension tripped me up more than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by setting up the recurrence relation for the probability of ruin, then solve it for the fair coin case using the boundary conditions. For the biased case, solve the resulting linear recurrence with the appropriate characteristic equation, and present the final formula clearly.

Pro tip: Mention that this is a classic martingale problem and that the fair case can be solved instantly by the optional stopping theorem, showing deeper probabilistic insight.

1. Define the problem and recurrence

Let P(i) be the probability of ruin starting with i dollars. Set up the recurrence P(i) = p P(i+1) + (1-p) P(i-1) with boundaries P(0)=1, P(N)=0.

2. Solve for fair coin (p=0.5)

For p=0.5, the recurrence simplifies to P(i) = (P(i+1)+P(i-1))/2, which implies P(i) is linear. Apply boundary conditions to get P(i) = 1 - i/N.

3. Solve for biased coin (p≠0.5)

Assume solution of form P(i) = r^i. The characteristic equation is p r^2 - r + (1-p) = 0, with roots 1 and (1-p)/p. Use boundary conditions to find constants.

4. Present final formula

For p≠0.5, P(i) = [ ( (1-p)/p )^i - ( (1-p)/p )^N ] / [ 1 - ( (1-p)/p )^N ]. Simplify and check limits (p→0.5 recovers fair case).

5. Discuss implications and edge cases

Mention behavior as N→∞, the role of the ratio (1-p)/p, and how this relates to risk of ruin in betting or trading strategies.

Key Points to Mention

  • Recurrence relation and boundary conditions
  • Optional stopping theorem and martingale approach for fair case
  • Characteristic equation for biased case
  • Final formula for probability of ruin
  • Limit as p→0.5 to recover fair case
  • Interpretation in terms of gambler's ruin and risk management

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

Q2

For a symmetric simple random walk starting at 0, derive: (a) the probability of ever returning to the origin, (b) the expected time of first return, and (c) explain why the walk is recurrent in 1D and 2D but transient in 3D and above.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Part (a) I got fine, return probability is 1 in 1D.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the simple symmetric random walk and the key quantities: return probability and expected first return time. Use generating functions or combinatorial identities to derive the 1D results, then generalize to higher dimensions using Fourier analysis or Green's functions. Finally, compare the convergence of the return probability series to explain recurrence vs. transience.

Pro tip: Emphasize the difference between recurrence (probability 1 of return) and positive recurrence (finite expected return time). In 1D and 2D, the walk is recurrent but null recurrent (infinite expected return time), while in 3D+ it is transient. This distinction is crucial and often overlooked.

1. Define the problem and key quantities

Clearly state the model: simple symmetric random walk on Z^d starting at 0. Define p_d as the probability of ever returning to the origin and E[T] as the expected first return time.

2. Derive 1D return probability

Use the reflection principle or generating functions to show that the probability of return to 0 in 1D is 1. For example, compute the generating function of first return probabilities and evaluate at 1.

3. Compute expected first return time in 1D

Show that the expected return time is infinite by analyzing the generating function or using the fact that the walk is null recurrent. Alternatively, use the known result that E[T] = ∞.

4. Generalize to higher dimensions

Use Fourier analysis or Green's functions to compute the return probability in d dimensions. Show that the walk is recurrent for d=1,2 and transient for d≥3 by examining the convergence of the integral ∫_{[-π,π]^d} 1/(1 - φ(θ)) dθ, where φ(θ) is the characteristic function.

5. Explain recurrence vs. transience

Summarize: In 1D and 2D, the expected number of returns is infinite, so the walk returns almost surely. In 3D and above, the expected number of returns is finite, so there is a positive probability of never returning.

Key Points to Mention

  • Definition of simple symmetric random walk and return probability.
  • Use of generating functions or Fourier analysis to compute return probabilities.
  • The distinction between recurrence and positive recurrence (null recurrence in 1D/2D).
  • The role of dimension: 1D and 2D are recurrent, 3D and higher are transient.
  • The expected first return time is infinite in 1D and 2D.
  • Connection to Pólya's theorem on random walks.

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