Morgan Stanley Interview Question

It's hard to complete within 1 hour.