Adding solution for Lecture 8, Problem 3