← Mavensecurities Interview Insights

Mavensecurities·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

Interviewed for a Quant Engineer role at Mavensecurities. One probability puzzle, clean setup, but the kind of question where you can trick yourself pretty badly if you're not careful about how you enumerate the cases.

Questions Asked (1)

Q1

A fair coin is flipped repeatedly until two consecutive flips show the same face (HH or TT). If N is the total number of flips at that point, what is the probability that N is even?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I went straight to writing out the sequences and almost convinced myself the answer was 1/2 by symmetry, which would've been wrong.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the process as a Markov chain with states representing the last flip (H or T) and the number of flips so far. Set up recurrence relations for the probability of ending on an even flip, then solve the system to find the probability. Alternatively, use symmetry and conditioning on the first flip to derive a simple equation.

Pro tip: After solving, verify your answer by simulating the process or checking edge cases (e.g., probability must be between 0 and 1). Also, be prepared to explain the intuition: the process is symmetric, so the probability might be 2/3, which is a common result for such stopping problems.

1. Define states and variables

Let E_H be the probability that N is even given the last flip was H and the process hasn't stopped, and similarly E_T for T. By symmetry, E_H = E_T = p.

2. Set up recurrence relations

From state H, the next flip is H with probability 1/2 (stopping with N even if current flip count is odd? Actually need to track parity). Better: define p_k as probability that the process stops on an even flip given the last flip was H and the current flip count is k. But simpler: condition on the first flip.

3. Solve the equations

Using symmetry, let p be the probability that N is even starting from scratch. After the first flip, we are in state H or T with equal probability. From there, the next flip either matches (stop) or differs (continue). Set up equation: p = 1/2 * (probability of stopping on even from state H) + 1/2 * (from state T). But due to symmetry, from state H, the probability of stopping on even is the same as from state T. Let q be that probability. Then p = q. Also, from state H, if next flip is H (prob 1/2), we stop; the total flips would be 2 (even) if we are at flip 2? Actually need to track the flip number.

4. Track parity explicitly

Let p_n be the probability that the process stops on an even flip given that we have just flipped a coin and the last flip was H (or T) and the current flip number is n. But since the process is memoryless except for the last flip, we can define p as the probability that starting from a state where the last flip was H and the next flip will be flip number m, the total number of flips N is even. However, the parity of N depends on m. So we need to consider the parity of the current flip count.

5. Compute final probability

After solving, we find that the probability is 2/3. Present the answer clearly and explain the reasoning.

Key Points to Mention

  • Markov chain or state machine modeling
  • Symmetry between heads and tails
  • Recurrence relations and solving linear equations
  • Conditioning on the first flip or last flip
  • Parity of the number of flips
  • Verification by simulation or edge cases

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