Pregunta de entrevista de Millennium

I was asked probability and coding question