Morgan Stanley Interview Question

Nothing very basic coding question