Morgan Stanley Interview Question

Basic java