#probability puzzle

A google and amazon interview question with a really clever solution