J.P. Morgan Interview Question

How did you come ut with that solution?