Pregunta de entrevista de Jane Street

Two combinatorics/probability questions.