Jane Street Interview Question

Handshake lemma, and something about conditional probability