Morgan Stanley Interview Question

3 coding questions of medium to difficult level