Jane Street Interview Question

coin toss Markov chain problem