Random Walk Hitting Probability Interview Questions
Random walk hitting probability interview prep for states, boundary conditions, fair and biased walks, and gambler ruin intuition.
Candidates practicing state recursion and absorbing-barrier probability questions.
Define states and boundaries
A hitting probability asks which boundary a process reaches first. Define p_i as the probability of hitting the target boundary from state i, then write the boundary values.
Fair walk recurrence
For a fair walk with moves up or down one step, p_i = 0.5p_{i-1} + 0.5p_{i+1}. Boundary conditions determine the solution.
Concrete example
Starting at 1 with absorbing barriers at 0 and 3, p_0 = 0, p_3 = 1, and p_1 = 0.5p_0 + 0.5p_2. Solving the linear system gives p_1 = 1/3.
Biased walk intuition
If upward moves are more likely than downward moves, the hitting probability is higher than the fair-walk linear value. Name the transition probabilities before solving.
Do not add the time step
Hitting probability recurrences do not include a +1 term. Expected time recurrences usually do. Mixing the two is a common mistake.
Common mistakes
Candidates often forget boundary values or use expected-time equations for probability. Write the target, state, transitions, and boundaries first.
Practice the pattern
Use the LeetQuidity curriculum and calibration to turn this topic into a focused practice plan.