State Street Interview Question

probability, and brain teaser, coding in r