Millennium Interview Question

I was asked probability and coding question