Pergunta de entrevista da empresa Jane Street

Two combinatorics/probability questions.