Implement Factorial and Squares | Morgan Stanley Interview Question