← Bnp Interview Insights

Bnp·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

BNP Data Scientist interview with a classic probability/logic puzzle that sounds deceptively simple but requires a real insight to crack. One round, one brain teaser, left me staring at the ceiling afterward.

Questions Asked (1)

Q1

You have N coins on a table, exactly H of which are heads-up, but you don't know which ones. Split them into two piles so that both piles contain the same number of heads-up coins. You can flip coins as needed. Describe a strategy that always works and explain why.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I stared at this for an embarrassingly long time.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the problem constraints and confirm that you can flip coins. Then, describe the simple strategy: take any H coins, flip them all, and make that one pile; the remaining N-H coins form the other pile. Finally, prove that both piles will have the same number of heads by analyzing the number of heads in the chosen H coins.

Pro tip: Emphasize that the strategy works regardless of which coins you pick, and that the proof relies on a clever invariant: the number of heads in the flipped pile equals the number of tails originally in that pile, which equals the number of heads in the remaining pile.

1. Clarify the problem

Restate the problem to ensure understanding: N coins, exactly H heads, unknown positions. You need to split into two piles with equal heads, and you can flip coins.

2. Propose the strategy

Select any H coins to form Pile A. Flip every coin in Pile A. The remaining N-H coins form Pile B (no flips).

3. Prove correctness

Let x be the number of heads in Pile A before flipping. Then Pile A has H - x tails. After flipping, Pile A has H - x heads. Pile B originally had H - x heads (since total heads is H). Thus both piles have H - x heads.

4. Address edge cases

Mention that if H = 0, both piles have 0 heads; if H = N, Pile A has all coins, flipped, resulting in 0 heads, and Pile B is empty (0 heads). The strategy works for any H between 0 and N.

5. Conclude and relate to role

Summarize that the solution is simple, deterministic, and requires no knowledge of which coins are heads. Highlight its relevance to data science: algorithmic thinking, invariants, and problem-solving.

Key Points to Mention

  • The strategy is independent of the actual distribution of heads; it works for any configuration.
  • The proof uses an invariant: the number of heads in the flipped pile equals the number of tails originally in that pile, which equals the number of heads in the other pile.
  • Flipping all coins in the chosen pile is key; flipping only some would not guarantee equality.
  • The solution is optimal in terms of simplicity and number of flips (exactly H flips).
  • Edge cases (H=0, H=N) are handled naturally by the strategy.
  • This problem demonstrates the importance of invariants and symmetry in algorithm design, relevant to data science.

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